From 1d6dd6623e843cdbef355f0713d8e47fe07e2a61 Mon Sep 17 00:00:00 2001 From: kbwo Date: Mon, 15 Jul 2024 19:13:19 +0900 Subject: [PATCH] refactor: rename directory --- .vim/coc-settings.json | 2 +- Cargo.toml | 2 +- crates/adapter/src/runner/cargo_test.rs | 10 ++-- crates/adapter/src/runner/go.rs | 2 +- crates/adapter/src/runner/jest.rs | 16 +++---- crates/adapter/src/runner/vitest.rs | 2 +- {test_proj => demo}/.vim/coc-settings.json | 0 {test_proj => demo}/go/README.md | 0 {test_proj => demo}/go/cases.go | 0 {test_proj => demo}/go/cases_test.go | 0 {test_proj => demo}/go/example.go | 0 {test_proj => demo}/go/example_test.go | 0 {test_proj => demo}/go/go.mod | 0 {test_proj => demo}/go/go.sum | 0 {test_proj => demo}/go/main.go | 0 {test_proj => demo}/go/main_tagged_test.go | 0 {test_proj => demo}/go/main_test.go | 0 {test_proj => demo}/go/many_table_test.go | 0 {test_proj => demo}/go/map_table_test.go | 0 {test_proj => demo}/go/suite_test.go | 0 .../go/three_level_nested_test.go | 0 {test_proj => demo}/jest/.gitignore | 0 {test_proj => demo}/jest/README.md | 2 +- {test_proj => demo}/jest/another.spec.js | 0 {test_proj => demo}/jest/bun.lockb | Bin {test_proj => demo}/jest/index.js | 0 {test_proj => demo}/jest/index.spec.js | 0 {test_proj => demo}/jest/jsconfig.json | 0 {test_proj => demo}/jest/output.json | 20 +++----- {test_proj => demo}/jest/package.json | 4 +- {test_proj => demo}/rust/.gitignore | 0 {test_proj => demo}/rust/Cargo.lock | 14 +++--- {test_proj => demo}/rust/Cargo.toml | 2 +- {test_proj => demo}/rust/src/lib.rs | 0 {test_proj => demo}/vitest/.gitignore | 0 {test_proj => demo}/vitest/.yarnrc.yml | 0 {test_proj => demo}/vitest/basic.test.ts | 0 {test_proj => demo}/vitest/package.json | 0 {test_proj => demo}/vitest/vite.config.ts | 0 {test_proj => demo}/vitest/yarn.lock | 0 src/server.rs | 45 ++++++++---------- 41 files changed, 54 insertions(+), 67 deletions(-) rename {test_proj => demo}/.vim/coc-settings.json (100%) rename {test_proj => demo}/go/README.md (100%) rename {test_proj => demo}/go/cases.go (100%) rename {test_proj => demo}/go/cases_test.go (100%) rename {test_proj => demo}/go/example.go (100%) rename {test_proj => demo}/go/example_test.go (100%) rename {test_proj => demo}/go/go.mod (100%) rename {test_proj => demo}/go/go.sum (100%) rename {test_proj => demo}/go/main.go (100%) rename {test_proj => demo}/go/main_tagged_test.go (100%) rename {test_proj => demo}/go/main_test.go (100%) rename {test_proj => demo}/go/many_table_test.go (100%) rename {test_proj => demo}/go/map_table_test.go (100%) rename {test_proj => demo}/go/suite_test.go (100%) rename {test_proj => demo}/go/three_level_nested_test.go (100%) rename {test_proj => demo}/jest/.gitignore (100%) rename {test_proj => demo}/jest/README.md (94%) rename {test_proj => demo}/jest/another.spec.js (100%) rename {test_proj => demo}/jest/bun.lockb (100%) rename {test_proj => demo}/jest/index.js (100%) rename {test_proj => demo}/jest/index.spec.js (100%) rename {test_proj => demo}/jest/jsconfig.json (100%) rename {test_proj => demo}/jest/output.json (67%) rename {test_proj => demo}/jest/package.json (89%) rename {test_proj => demo}/rust/.gitignore (100%) rename {test_proj => demo}/rust/Cargo.lock (99%) rename {test_proj => demo}/rust/Cargo.toml (91%) rename {test_proj => demo}/rust/src/lib.rs (100%) rename {test_proj => demo}/vitest/.gitignore (100%) rename {test_proj => demo}/vitest/.yarnrc.yml (100%) rename {test_proj => demo}/vitest/basic.test.ts (100%) rename {test_proj => demo}/vitest/package.json (100%) rename {test_proj => demo}/vitest/vite.config.ts (100%) rename {test_proj => demo}/vitest/yarn.lock (100%) diff --git a/.vim/coc-settings.json b/.vim/coc-settings.json index f66ce6e..d930726 100644 --- a/.vim/coc-settings.json +++ b/.vim/coc-settings.json @@ -7,7 +7,7 @@ "path": "testing-ls-adapter", "extra_args": ["--test-kind=cargo-test", "--workspace"], "include_patterns": ["/**/*.rs"], - "exclude_patterns": ["/test_proj/**/*"], + "exclude_patterns": ["/demo/**/*"], "workspace_dir": "." } ] diff --git a/Cargo.toml b/Cargo.toml index 2ef64bb..47aadd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" [workspace] members = [ "crates/adapter"] -exclude = ["test_proj"] +exclude = ["demo"] [[bin]] name = "testing-language-server" diff --git a/crates/adapter/src/runner/cargo_test.rs b/crates/adapter/src/runner/cargo_test.rs index bf6fde4..2bd8c3b 100644 --- a/crates/adapter/src/runner/cargo_test.rs +++ b/crates/adapter/src/runner/cargo_test.rs @@ -323,7 +323,7 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace #[test] fn test_discover() { - let file_path = "../../test_proj/rust/src/lib.rs"; + let file_path = "../../demo/rust/src/lib.rs"; discover(file_path).unwrap(); } @@ -332,16 +332,16 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace let current_dir = std::env::current_dir().unwrap(); let librs = current_dir.join("src/lib.rs"); let mainrs = current_dir.join("src/main.rs"); - let absolute_path_of_test_proj = current_dir.join("../../test_proj/rust"); - let test_proj_librs = absolute_path_of_test_proj.join("src/lib.rs"); - let file_paths: Vec = [librs, mainrs, test_proj_librs] + let absolute_path_of_demo = current_dir.join("../../demo/rust"); + let demo_librs = absolute_path_of_demo.join("src/lib.rs"); + let file_paths: Vec = [librs, mainrs, demo_librs] .iter() .map(|file_path| file_path.to_str().unwrap().to_string()) .collect(); let workspaces = detect_workspaces(&file_paths); assert_eq!(workspaces.len(), 2); - assert!(workspaces.contains_key(absolute_path_of_test_proj.to_str().unwrap())); + assert!(workspaces.contains_key(absolute_path_of_demo.to_str().unwrap())); assert!(workspaces.contains_key(current_dir.to_str().unwrap())); } } diff --git a/crates/adapter/src/runner/go.rs b/crates/adapter/src/runner/go.rs index 652059e..2034709 100644 --- a/crates/adapter/src/runner/go.rs +++ b/crates/adapter/src/runner/go.rs @@ -381,7 +381,7 @@ mod tests { #[test] fn test_discover() { - let file_path = "../../test_proj/go/cases_test.go"; + let file_path = "../../demo/go/cases_test.go"; let test_items = discover(file_path).unwrap(); assert!(!test_items.is_empty()); } diff --git a/crates/adapter/src/runner/jest.rs b/crates/adapter/src/runner/jest.rs index 9a7d26b..541212e 100644 --- a/crates/adapter/src/runner/jest.rs +++ b/crates/adapter/src/runner/jest.rs @@ -289,13 +289,13 @@ mod tests { fn test_parse_diagnostics() { let test_result = std::env::current_dir() .unwrap() - .join("../../test_proj/jest/output.json"); + .join("../../demo/jest/output.json"); let test_result = std::fs::read_to_string(test_result).unwrap(); let diagnostics = parse_diagnostics( &test_result, vec![ - "/absolute_path/test_proj/jest/index.spec.js".to_string(), - "/absolute_path/test_proj/jest/another.spec.js".to_string(), + "/absolute_path/demo/jest/index.spec.js".to_string(), + "/absolute_path/demo/jest/another.spec.js".to_string(), ], ) .unwrap(); @@ -305,22 +305,22 @@ mod tests { #[test] fn test_detect_workspace() { let current_dir = std::env::current_dir().unwrap(); - let absolute_path_of_test_proj = current_dir.join("../../test_proj/jest"); - let test_proj_indexjs = absolute_path_of_test_proj.join("index.spec.js"); - let file_paths: Vec = [test_proj_indexjs] + let absolute_path_of_demo = current_dir.join("../../demo/jest"); + let demo_indexjs = absolute_path_of_demo.join("index.spec.js"); + let file_paths: Vec = [demo_indexjs] .iter() .map(|file_path| file_path.to_str().unwrap().to_string()) .collect(); let detect_result = detect_workspaces(file_paths); assert_eq!(detect_result.len(), 1); detect_result.iter().for_each(|(workspace, _)| { - assert_eq!(workspace, absolute_path_of_test_proj.to_str().unwrap()); + assert_eq!(workspace, absolute_path_of_demo.to_str().unwrap()); }); } #[test] fn test_discover() { - let file_path = "../../test_proj/jest/index.spec.js"; + let file_path = "../../demo/jest/index.spec.js"; let test_items = discover(file_path).unwrap(); assert_eq!(test_items.len(), 1); assert_eq!( diff --git a/crates/adapter/src/runner/vitest.rs b/crates/adapter/src/runner/vitest.rs index 3651b05..34549f0 100644 --- a/crates/adapter/src/runner/vitest.rs +++ b/crates/adapter/src/runner/vitest.rs @@ -270,7 +270,7 @@ mod tests { #[test] fn test_discover() { - let file_path = "../../test_proj/vitest/basic.test.ts"; + let file_path = "../../demo/vitest/basic.test.ts"; let test_items = discover(file_path).unwrap(); assert_eq!(test_items.len(), 2); assert_eq!( diff --git a/test_proj/.vim/coc-settings.json b/demo/.vim/coc-settings.json similarity index 100% rename from test_proj/.vim/coc-settings.json rename to demo/.vim/coc-settings.json diff --git a/test_proj/go/README.md b/demo/go/README.md similarity index 100% rename from test_proj/go/README.md rename to demo/go/README.md diff --git a/test_proj/go/cases.go b/demo/go/cases.go similarity index 100% rename from test_proj/go/cases.go rename to demo/go/cases.go diff --git a/test_proj/go/cases_test.go b/demo/go/cases_test.go similarity index 100% rename from test_proj/go/cases_test.go rename to demo/go/cases_test.go diff --git a/test_proj/go/example.go b/demo/go/example.go similarity index 100% rename from test_proj/go/example.go rename to demo/go/example.go diff --git a/test_proj/go/example_test.go b/demo/go/example_test.go similarity index 100% rename from test_proj/go/example_test.go rename to demo/go/example_test.go diff --git a/test_proj/go/go.mod b/demo/go/go.mod similarity index 100% rename from test_proj/go/go.mod rename to demo/go/go.mod diff --git a/test_proj/go/go.sum b/demo/go/go.sum similarity index 100% rename from test_proj/go/go.sum rename to demo/go/go.sum diff --git a/test_proj/go/main.go b/demo/go/main.go similarity index 100% rename from test_proj/go/main.go rename to demo/go/main.go diff --git a/test_proj/go/main_tagged_test.go b/demo/go/main_tagged_test.go similarity index 100% rename from test_proj/go/main_tagged_test.go rename to demo/go/main_tagged_test.go diff --git a/test_proj/go/main_test.go b/demo/go/main_test.go similarity index 100% rename from test_proj/go/main_test.go rename to demo/go/main_test.go diff --git a/test_proj/go/many_table_test.go b/demo/go/many_table_test.go similarity index 100% rename from test_proj/go/many_table_test.go rename to demo/go/many_table_test.go diff --git a/test_proj/go/map_table_test.go b/demo/go/map_table_test.go similarity index 100% rename from test_proj/go/map_table_test.go rename to demo/go/map_table_test.go diff --git a/test_proj/go/suite_test.go b/demo/go/suite_test.go similarity index 100% rename from test_proj/go/suite_test.go rename to demo/go/suite_test.go diff --git a/test_proj/go/three_level_nested_test.go b/demo/go/three_level_nested_test.go similarity index 100% rename from test_proj/go/three_level_nested_test.go rename to demo/go/three_level_nested_test.go diff --git a/test_proj/jest/.gitignore b/demo/jest/.gitignore similarity index 100% rename from test_proj/jest/.gitignore rename to demo/jest/.gitignore diff --git a/test_proj/jest/README.md b/demo/jest/README.md similarity index 94% rename from test_proj/jest/README.md rename to demo/jest/README.md index 2b2eca2..0771f53 100644 --- a/test_proj/jest/README.md +++ b/demo/jest/README.md @@ -1,4 +1,4 @@ -# test_proj +# demo To install dependencies: diff --git a/test_proj/jest/another.spec.js b/demo/jest/another.spec.js similarity index 100% rename from test_proj/jest/another.spec.js rename to demo/jest/another.spec.js diff --git a/test_proj/jest/bun.lockb b/demo/jest/bun.lockb similarity index 100% rename from test_proj/jest/bun.lockb rename to demo/jest/bun.lockb diff --git a/test_proj/jest/index.js b/demo/jest/index.js similarity index 100% rename from test_proj/jest/index.js rename to demo/jest/index.js diff --git a/test_proj/jest/index.spec.js b/demo/jest/index.spec.js similarity index 100% rename from test_proj/jest/index.spec.js rename to demo/jest/index.spec.js diff --git a/test_proj/jest/jsconfig.json b/demo/jest/jsconfig.json similarity index 100% rename from test_proj/jest/jsconfig.json rename to demo/jest/jsconfig.json diff --git a/test_proj/jest/output.json b/demo/jest/output.json similarity index 67% rename from test_proj/jest/output.json rename to demo/jest/output.json index b7379e9..cd52c72 100644 --- a/test_proj/jest/output.json +++ b/demo/jest/output.json @@ -32,9 +32,7 @@ { "assertionResults": [ { - "ancestorTitles": [ - "index" - ], + "ancestorTitles": ["index"], "duration": 3, "failureDetails": [ { @@ -48,7 +46,7 @@ } ], "failureMessages": [ - "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m0\u001b[39m\nReceived: \u001b[31m1\u001b[39m\n at Object.toBe (/absolute_path/test_proj/jest/index.spec.js:4:15)\n at Promise.then.completed (/absolute_path/test_proj/jest/node_modules/jest-circus/build/utils.js:298:28)\n at new Promise ()\n at callAsyncCircusFn (/absolute_path/test_proj/jest/node_modules/jest-circus/build/utils.js:231:10)\n at _callCircusTest (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:316:40)\n at _runTest (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:252:3)\n at _runTestsForDescribeBlock (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:126:9)\n at _runTestsForDescribeBlock (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:121:9)\n at run (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:71:3)\n at runAndTransformResultsToJestFormat (/absolute_path/test_proj/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)\n at jestAdapter (/absolute_path/test_proj/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)\n at runTestInternal (/absolute_path/test_proj/jest/node_modules/jest-runner/build/runTest.js:367:16)\n at runTest (/absolute_path/test_proj/jest/node_modules/jest-runner/build/runTest.js:444:34)" + "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m0\u001b[39m\nReceived: \u001b[31m1\u001b[39m\n at Object.toBe (/absolute_path/demo/jest/index.spec.js:4:15)\n at Promise.then.completed (/absolute_path/demo/jest/node_modules/jest-circus/build/utils.js:298:28)\n at new Promise ()\n at callAsyncCircusFn (/absolute_path/demo/jest/node_modules/jest-circus/build/utils.js:231:10)\n at _callCircusTest (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:316:40)\n at _runTest (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:252:3)\n at _runTestsForDescribeBlock (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:126:9)\n at _runTestsForDescribeBlock (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:121:9)\n at run (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:71:3)\n at runAndTransformResultsToJestFormat (/absolute_path/demo/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)\n at jestAdapter (/absolute_path/demo/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)\n at runTestInternal (/absolute_path/demo/jest/node_modules/jest-runner/build/runTest.js:367:16)\n at runTest (/absolute_path/demo/jest/node_modules/jest-runner/build/runTest.js:444:34)" ], "fullName": "index fail", "invocations": 1, @@ -64,7 +62,7 @@ ], "endTime": 1714484637874, "message": "\u001b[1m\u001b[31m \u001b[1m● \u001b[22m\u001b[1mindex › fail\u001b[39m\u001b[22m\n\n \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\n Expected: \u001b[32m0\u001b[39m\n Received: \u001b[31m1\u001b[39m\n\u001b[2m\u001b[22m\n\u001b[2m \u001b[0m \u001b[90m 2 |\u001b[39m\u001b[22m\n\u001b[2m \u001b[90m 3 |\u001b[39m it(\u001b[32m\"fail\"\u001b[39m\u001b[33m,\u001b[39m () \u001b[33m=>\u001b[39m {\u001b[22m\n\u001b[2m \u001b[31m\u001b[1m>\u001b[22m\u001b[2m\u001b[39m\u001b[90m 4 |\u001b[39m expect(\u001b[35m1\u001b[39m)\u001b[33m.\u001b[39mtoBe(\u001b[35m0\u001b[39m)\u001b[22m\n\u001b[2m \u001b[90m |\u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[2m\u001b[39m\u001b[22m\n\u001b[2m \u001b[90m 5 |\u001b[39m })\u001b[22m\n\u001b[2m \u001b[90m 6 |\u001b[39m\u001b[22m\n\u001b[2m \u001b[90m 7 |\u001b[39m })\u001b[0m\u001b[22m\n\u001b[2m\u001b[22m\n\u001b[2m \u001b[2mat Object.toBe (\u001b[22m\u001b[2m\u001b[0m\u001b[36mindex.spec.js\u001b[39m\u001b[0m\u001b[2m:4:15)\u001b[22m\u001b[2m\u001b[22m\n", - "name": "/absolute_path/test_proj/jest/index.spec.js", + "name": "/absolute_path/demo/jest/index.spec.js", "startTime": 1714484637684, "status": "failed", "summary": "" @@ -72,9 +70,7 @@ { "assertionResults": [ { - "ancestorTitles": [ - "another" - ], + "ancestorTitles": ["another"], "duration": 2, "failureDetails": [ { @@ -88,7 +84,7 @@ } ], "failureMessages": [ - "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m0\u001b[39m\nReceived: \u001b[31m1\u001b[39m\n at Object.toBe (/absolute_path/test_proj/jest/another.spec.js:4:15)\n at Promise.then.completed (/absolute_path/test_proj/jest/node_modules/jest-circus/build/utils.js:298:28)\n at new Promise ()\n at callAsyncCircusFn (/absolute_path/test_proj/jest/node_modules/jest-circus/build/utils.js:231:10)\n at _callCircusTest (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:316:40)\n at _runTest (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:252:3)\n at _runTestsForDescribeBlock (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:126:9)\n at _runTestsForDescribeBlock (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:121:9)\n at run (/absolute_path/test_proj/jest/node_modules/jest-circus/build/run.js:71:3)\n at runAndTransformResultsToJestFormat (/absolute_path/test_proj/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)\n at jestAdapter (/absolute_path/test_proj/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)\n at runTestInternal (/absolute_path/test_proj/jest/node_modules/jest-runner/build/runTest.js:367:16)\n at runTest (/absolute_path/test_proj/jest/node_modules/jest-runner/build/runTest.js:444:34)" + "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m0\u001b[39m\nReceived: \u001b[31m1\u001b[39m\n at Object.toBe (/absolute_path/demo/jest/another.spec.js:4:15)\n at Promise.then.completed (/absolute_path/demo/jest/node_modules/jest-circus/build/utils.js:298:28)\n at new Promise ()\n at callAsyncCircusFn (/absolute_path/demo/jest/node_modules/jest-circus/build/utils.js:231:10)\n at _callCircusTest (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:316:40)\n at _runTest (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:252:3)\n at _runTestsForDescribeBlock (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:126:9)\n at _runTestsForDescribeBlock (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:121:9)\n at run (/absolute_path/demo/jest/node_modules/jest-circus/build/run.js:71:3)\n at runAndTransformResultsToJestFormat (/absolute_path/demo/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)\n at jestAdapter (/absolute_path/demo/jest/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)\n at runTestInternal (/absolute_path/demo/jest/node_modules/jest-runner/build/runTest.js:367:16)\n at runTest (/absolute_path/demo/jest/node_modules/jest-runner/build/runTest.js:444:34)" ], "fullName": "another fail", "invocations": 1, @@ -102,9 +98,7 @@ "title": "fail" }, { - "ancestorTitles": [ - "another" - ], + "ancestorTitles": ["another"], "duration": 1, "failureDetails": [], "failureMessages": [], @@ -122,7 +116,7 @@ ], "endTime": 1714484637974, "message": "\u001b[1m\u001b[31m \u001b[1m● \u001b[22m\u001b[1manother › fail\u001b[39m\u001b[22m\n\n \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\n Expected: \u001b[32m0\u001b[39m\n Received: \u001b[31m1\u001b[39m\n\u001b[2m\u001b[22m\n\u001b[2m \u001b[0m \u001b[90m 2 |\u001b[39m\u001b[22m\n\u001b[2m \u001b[90m 3 |\u001b[39m it(\u001b[32m\"fail\"\u001b[39m\u001b[33m,\u001b[39m () \u001b[33m=>\u001b[39m {\u001b[22m\n\u001b[2m \u001b[31m\u001b[1m>\u001b[22m\u001b[2m\u001b[39m\u001b[90m 4 |\u001b[39m expect(\u001b[35m1\u001b[39m)\u001b[33m.\u001b[39mtoBe(\u001b[35m0\u001b[39m)\u001b[22m\n\u001b[2m \u001b[90m |\u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[2m\u001b[39m\u001b[22m\n\u001b[2m \u001b[90m 5 |\u001b[39m })\u001b[22m\n\u001b[2m \u001b[90m 6 |\u001b[39m\u001b[22m\n\u001b[2m \u001b[90m 7 |\u001b[39m it(\u001b[32m\"pass\"\u001b[39m\u001b[33m,\u001b[39m () \u001b[33m=>\u001b[39m {\u001b[0m\u001b[22m\n\u001b[2m\u001b[22m\n\u001b[2m \u001b[2mat Object.toBe (\u001b[22m\u001b[2m\u001b[0m\u001b[36manother.spec.js\u001b[39m\u001b[0m\u001b[2m:4:15)\u001b[22m\u001b[2m\u001b[22m\n", - "name": "/absolute_path/test_proj/jest/another.spec.js", + "name": "/absolute_path/demo/jest/another.spec.js", "startTime": 1714484637879, "status": "failed", "summary": "" diff --git a/test_proj/jest/package.json b/demo/jest/package.json similarity index 89% rename from test_proj/jest/package.json rename to demo/jest/package.json index b4719dc..0dcfcbd 100644 --- a/test_proj/jest/package.json +++ b/demo/jest/package.json @@ -1,5 +1,5 @@ { - "name": "test_proj", + "name": "demo", "module": "index.js", "type": "module", "devDependencies": { @@ -10,4 +10,4 @@ "peerDependencies": { "typescript": "^5.0.0" } -} \ No newline at end of file +} diff --git a/test_proj/rust/.gitignore b/demo/rust/.gitignore similarity index 100% rename from test_proj/rust/.gitignore rename to demo/rust/.gitignore diff --git a/test_proj/rust/Cargo.lock b/demo/rust/Cargo.lock similarity index 99% rename from test_proj/rust/Cargo.lock rename to demo/rust/Cargo.lock index cef7872..531608a 100644 --- a/test_proj/rust/Cargo.lock +++ b/demo/rust/Cargo.lock @@ -62,6 +62,13 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "demo" +version = "0.1.0" +dependencies = [ + "tokio", +] + [[package]] name = "gimli" version = "0.28.1" @@ -239,13 +246,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "test_proj" -version = "0.1.0" -dependencies = [ - "tokio", -] - [[package]] name = "tokio" version = "1.37.0" diff --git a/test_proj/rust/Cargo.toml b/demo/rust/Cargo.toml similarity index 91% rename from test_proj/rust/Cargo.toml rename to demo/rust/Cargo.toml index b06b397..dccb943 100644 --- a/test_proj/rust/Cargo.toml +++ b/demo/rust/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "test_proj" +name = "demo" version = "0.1.0" edition = "2021" diff --git a/test_proj/rust/src/lib.rs b/demo/rust/src/lib.rs similarity index 100% rename from test_proj/rust/src/lib.rs rename to demo/rust/src/lib.rs diff --git a/test_proj/vitest/.gitignore b/demo/vitest/.gitignore similarity index 100% rename from test_proj/vitest/.gitignore rename to demo/vitest/.gitignore diff --git a/test_proj/vitest/.yarnrc.yml b/demo/vitest/.yarnrc.yml similarity index 100% rename from test_proj/vitest/.yarnrc.yml rename to demo/vitest/.yarnrc.yml diff --git a/test_proj/vitest/basic.test.ts b/demo/vitest/basic.test.ts similarity index 100% rename from test_proj/vitest/basic.test.ts rename to demo/vitest/basic.test.ts diff --git a/test_proj/vitest/package.json b/demo/vitest/package.json similarity index 100% rename from test_proj/vitest/package.json rename to demo/vitest/package.json diff --git a/test_proj/vitest/vite.config.ts b/demo/vitest/vite.config.ts similarity index 100% rename from test_proj/vitest/vite.config.ts rename to demo/vitest/vite.config.ts diff --git a/test_proj/vitest/yarn.lock b/demo/vitest/yarn.lock similarity index 100% rename from test_proj/vitest/yarn.lock rename to demo/vitest/yarn.lock diff --git a/src/server.rs b/src/server.rs index 63111e1..7e9ea27 100644 --- a/src/server.rs +++ b/src/server.rs @@ -577,12 +577,12 @@ mod tests { #[test] fn test_check_file() { - let abs_path_of_test_proj = std::env::current_dir().unwrap().join("test_proj/rust"); + let abs_path_of_demo = std::env::current_dir().unwrap().join("demo/rust"); let mut server = TestingLS { initialize_params: InitializeParams { workspace_folders: Some(vec![WorkspaceFolder { - uri: Url::from_file_path(&abs_path_of_test_proj).unwrap(), - name: "test_proj".to_string(), + uri: Url::from_file_path(&abs_path_of_demo).unwrap(), + name: "demo".to_string(), }]), ..InitializeParams::default() }, @@ -591,13 +591,13 @@ mod tests { }, workspaces_cache: Vec::new(), }; - let librs = abs_path_of_test_proj.join("lib.rs"); + let librs = abs_path_of_demo.join("lib.rs"); server.check_file(librs.to_str().unwrap(), true).unwrap(); } #[test] fn test_check_workspace() { - let abs_path_of_test_proj = std::env::current_dir().unwrap().join("test_proj/rust"); + let abs_path_of_demo = std::env::current_dir().unwrap().join("demo/rust"); let abs_path_of_rust_adapter = std::env::current_dir() .unwrap() .join("target/debug/testing-ls-adapter"); @@ -613,8 +613,8 @@ mod tests { let mut server = TestingLS { initialize_params: InitializeParams { workspace_folders: Some(vec![WorkspaceFolder { - uri: Url::from_file_path(abs_path_of_test_proj.clone()).unwrap(), - name: "test_proj".to_string(), + uri: Url::from_file_path(abs_path_of_demo.clone()).unwrap(), + name: "demo".to_string(), }]), ..InitializeParams::default() }, @@ -634,7 +634,7 @@ mod tests { .workspaces .iter() .for_each(|(workspace, paths)| { - assert_eq!(workspace, abs_path_of_test_proj.to_str().unwrap()); + assert_eq!(workspace, abs_path_of_demo.to_str().unwrap()); paths.iter().for_each(|path| { assert!(path.contains("rust/src")); }); @@ -644,20 +644,20 @@ mod tests { #[test] fn project_files_are_filtered_by_extension() { - let absolute_path_of_test_proj = std::env::current_dir().unwrap().join("test_proj"); + let absolute_path_of_demo = std::env::current_dir().unwrap().join("demo"); let files = TestingLS::project_files( - &absolute_path_of_test_proj.clone(), + &absolute_path_of_demo.clone(), &["/rust/src/lib.rs".to_string()], &["/rust/target/**/*".to_string()], ); - let librs = absolute_path_of_test_proj.join("rust/src/lib.rs"); + let librs = absolute_path_of_demo.join("rust/src/lib.rs"); assert_eq!(files, vec![librs.to_str().unwrap()]); let files = TestingLS::project_files( - &absolute_path_of_test_proj.clone(), + &absolute_path_of_demo.clone(), &["jest/*.spec.js".to_string()], &["jest/another.spec.js".to_string()], ); - let test_file = absolute_path_of_test_proj.join("jest/index.spec.js"); + let test_file = absolute_path_of_demo.join("jest/index.spec.js"); assert_eq!(files, vec![test_file.to_str().unwrap()]); } @@ -673,18 +673,15 @@ mod tests { extra_args: vec!["--invalid-arg".to_string()], ..Default::default() }; - let abs_path_of_test_proj = std::env::current_dir().unwrap().join("test_proj/rust"); - let files = TestingLS::project_files( - &abs_path_of_test_proj.clone(), - &["/**/*.rs".to_string()], - &[], - ); + let abs_path_of_demo = std::env::current_dir().unwrap().join("demo/rust"); + let files = + TestingLS::project_files(&abs_path_of_demo.clone(), &["/**/*.rs".to_string()], &[]); let server = TestingLS { initialize_params: InitializeParams { workspace_folders: Some(vec![WorkspaceFolder { - uri: Url::from_file_path(&abs_path_of_test_proj).unwrap(), - name: "test_proj".to_string(), + uri: Url::from_file_path(&abs_path_of_demo).unwrap(), + name: "demo".to_string(), }]), ..InitializeParams::default() }, @@ -694,11 +691,7 @@ mod tests { workspaces_cache: Vec::new(), }; let diagnostics = server - .get_diagnostics( - &adapter_conf, - abs_path_of_test_proj.to_str().unwrap(), - &files, - ) + .get_diagnostics(&adapter_conf, abs_path_of_demo.to_str().unwrap(), &files) .unwrap(); assert_eq!(diagnostics.len(), 1); let diagnostic = diagnostics.first().unwrap().1.first().unwrap();