From 16c53af799e1c3489a8a0d6b8070e400c2507ff9 Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Sun, 16 May 2021 00:56:18 +0100 Subject: [PATCH 1/8] test(typescript): test against latest TS 3.9 (.9) --- package-lock.json | 6 +++--- package.json | 2 +- test/fixtures/index.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9e84083..51ee354 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8566,9 +8566,9 @@ "dev": true }, "typescript39": { - "version": "npm:typescript@3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "version": "npm:typescript@3.9.9", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", + "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 8ea3e97..69f486f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "typescript": "3.7.5", "typescript29": "npm:typescript@2.9.1", "typescript30": "npm:typescript@3.0.1", - "typescript39": "npm:typescript@^3.9.7" + "typescript39": "npm:typescript@3.9.9" }, "dependencies": { "mock-require": "^3.0.3" diff --git a/test/fixtures/index.js b/test/fixtures/index.js index f7f6914..2b934bb 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -23,7 +23,7 @@ module.exports = { }, TS_VERSIONS: { // Latest and oldest of each major release - '3.9': { version: '3.9.7', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript39') }, + '3.9': { version: '3.9.9', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript39') }, '3.0': { version: '3.0.1', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript30') }, '2.9': { version: '2.9.1', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript29') }, // Can't go back further than 2.8 because tsserver won't work on node 10 (https://github.com/microsoft/TypeScript/commit/1fc3aebc20a13048d6595395f721c6b0078c2c08) From 548fb215582cc01157510ea772b0a51fae2b224f Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Sun, 16 May 2021 01:52:21 +0100 Subject: [PATCH 2/8] test(typescript): allow test plugins to load in newer TS versions Loading plugins by path is blocked in newer TS versions for security reasons. Convert the test plugins to packages and install them locally so we can include them in the tsconfig by name. --- package-lock.json | 20 +++++++++++++++++++ package.json | 5 +++++ test/fixtures/index.js | 10 +++++----- .../index.js} | 0 .../break-mock-require-plugin/package.json | 5 +++++ .../index.js} | 0 .../plugins/log-cwd-plugin/package.json | 5 +++++ .../index.js} | 0 .../log-loadtime-cwd-plugin/package.json | 5 +++++ .../index.js} | 0 .../log-top-ts-versions-plugin/package.json | 5 +++++ .../index.js} | 0 .../log-ts-versions-plugin/package.json | 5 +++++ 13 files changed, 55 insertions(+), 5 deletions(-) rename test/fixtures/plugins/{breakMockRequirePlugin.js => break-mock-require-plugin/index.js} (100%) create mode 100644 test/fixtures/plugins/break-mock-require-plugin/package.json rename test/fixtures/plugins/{logCwdPlugin.js => log-cwd-plugin/index.js} (100%) create mode 100644 test/fixtures/plugins/log-cwd-plugin/package.json rename test/fixtures/plugins/{logLoadtimeCwdPlugin.js => log-loadtime-cwd-plugin/index.js} (100%) create mode 100644 test/fixtures/plugins/log-loadtime-cwd-plugin/package.json rename test/fixtures/plugins/{logTopTsVersionsPlugin.js => log-top-ts-versions-plugin/index.js} (100%) create mode 100644 test/fixtures/plugins/log-top-ts-versions-plugin/package.json rename test/fixtures/plugins/{logTsVersionsPlugin.js => log-ts-versions-plugin/index.js} (100%) create mode 100644 test/fixtures/plugins/log-ts-versions-plugin/package.json diff --git a/package-lock.json b/package-lock.json index 51ee354..b8b870c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -479,6 +479,26 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "@vs-compat-ts-plugin/break-mock-require-plugin": { + "version": "file:test/fixtures/plugins/break-mock-require-plugin", + "dev": true + }, + "@vs-compat-ts-plugin/log-cwd-plugin": { + "version": "file:test/fixtures/plugins/log-cwd-plugin", + "dev": true + }, + "@vs-compat-ts-plugin/log-loadtime-cwd-plugin": { + "version": "file:test/fixtures/plugins/log-loadtime-cwd-plugin", + "dev": true + }, + "@vs-compat-ts-plugin/log-top-ts-versions-plugin": { + "version": "file:test/fixtures/plugins/log-top-ts-versions-plugin", + "dev": true + }, + "@vs-compat-ts-plugin/log-ts-versions-plugin": { + "version": "file:test/fixtures/plugins/log-ts-versions-plugin", + "dev": true + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", diff --git a/package.json b/package.json index 69f486f..ffab119 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,11 @@ "devDependencies": { "@semantic-release/changelog": "^5.0.1", "@semantic-release/git": "^9.0.0", + "@vs-compat-ts-plugin/break-mock-require-plugin": "file:test/fixtures/plugins/break-mock-require-plugin", + "@vs-compat-ts-plugin/log-cwd-plugin": "file:test/fixtures/plugins/log-cwd-plugin", + "@vs-compat-ts-plugin/log-loadtime-cwd-plugin": "file:test/fixtures/plugins/log-loadtime-cwd-plugin", + "@vs-compat-ts-plugin/log-top-ts-versions-plugin": "file:test/fixtures/plugins/log-top-ts-versions-plugin", + "@vs-compat-ts-plugin/log-ts-versions-plugin": "file:test/fixtures/plugins/log-ts-versions-plugin", "commitizen": "^4.2.0", "cz-conventional-changelog": "^3.2.0", "husky": "^4.2.5", diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 2b934bb..1b58d75 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -7,19 +7,19 @@ module.exports = { namelessPath: '../index.js' // For loading the plugin without having the package name in the path }, LOG_CWD_PLUGIN: { - name: 'logCwdPlugin', path: path.resolve(__dirname, 'plugins', 'logCwdPlugin.js') + name: 'logCwdPlugin', path: '@vs-compat-ts-plugin/log-cwd-plugin' }, LOG_LOADTIME_CWD_PLUGIN: { - name: 'logLoadtimeCwdPlugin', path: path.resolve(__dirname, 'plugins', 'logLoadtimeCwdPlugin.js') + name: 'logLoadtimeCwdPlugin', path: '@vs-compat-ts-plugin/log-loadtime-cwd-plugin' }, LOG_TS_VERSIONS_PLUGIN: { - name: 'logTsVersionsPlugin', path: path.resolve(__dirname, 'plugins', 'logTsVersionsPlugin.js') + name: 'logTsVersionsPlugin', path: '@vs-compat-ts-plugin/log-ts-versions-plugin' }, LOG_TOP_TS_VERSIONS_PLUGIN: { - name: 'logTopTsVersionsPlugin', path: path.resolve(__dirname, 'plugins', 'logTopTsVersionsPlugin.js') + name: 'logTopTsVersionsPlugin', path: '@vs-compat-ts-plugin/log-top-ts-versions-plugin' }, BREAK_MOCK_REQUIRE_PLUGIN: { - name: 'breakMockRequirePlugin', path: path.resolve(__dirname, 'plugins', 'breakMockRequirePlugin.js') + name: 'breakMockRequirePlugin', path: '@vs-compat-ts-plugin/break-mock-require-plugin' }, TS_VERSIONS: { // Latest and oldest of each major release diff --git a/test/fixtures/plugins/breakMockRequirePlugin.js b/test/fixtures/plugins/break-mock-require-plugin/index.js similarity index 100% rename from test/fixtures/plugins/breakMockRequirePlugin.js rename to test/fixtures/plugins/break-mock-require-plugin/index.js diff --git a/test/fixtures/plugins/break-mock-require-plugin/package.json b/test/fixtures/plugins/break-mock-require-plugin/package.json new file mode 100644 index 0000000..e2aa88b --- /dev/null +++ b/test/fixtures/plugins/break-mock-require-plugin/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vs-compat-ts-plugin/break-mock-require-plugin", + "version": "0.0.0", + "private": true +} \ No newline at end of file diff --git a/test/fixtures/plugins/logCwdPlugin.js b/test/fixtures/plugins/log-cwd-plugin/index.js similarity index 100% rename from test/fixtures/plugins/logCwdPlugin.js rename to test/fixtures/plugins/log-cwd-plugin/index.js diff --git a/test/fixtures/plugins/log-cwd-plugin/package.json b/test/fixtures/plugins/log-cwd-plugin/package.json new file mode 100644 index 0000000..754d2f8 --- /dev/null +++ b/test/fixtures/plugins/log-cwd-plugin/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vs-compat-ts-plugin/log-cwd-plugin", + "version": "0.0.0", + "private": true +} \ No newline at end of file diff --git a/test/fixtures/plugins/logLoadtimeCwdPlugin.js b/test/fixtures/plugins/log-loadtime-cwd-plugin/index.js similarity index 100% rename from test/fixtures/plugins/logLoadtimeCwdPlugin.js rename to test/fixtures/plugins/log-loadtime-cwd-plugin/index.js diff --git a/test/fixtures/plugins/log-loadtime-cwd-plugin/package.json b/test/fixtures/plugins/log-loadtime-cwd-plugin/package.json new file mode 100644 index 0000000..57c88c2 --- /dev/null +++ b/test/fixtures/plugins/log-loadtime-cwd-plugin/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vs-compat-ts-plugin/log-loadtime-cwd-plugin", + "version": "0.0.0", + "private": true +} \ No newline at end of file diff --git a/test/fixtures/plugins/logTopTsVersionsPlugin.js b/test/fixtures/plugins/log-top-ts-versions-plugin/index.js similarity index 100% rename from test/fixtures/plugins/logTopTsVersionsPlugin.js rename to test/fixtures/plugins/log-top-ts-versions-plugin/index.js diff --git a/test/fixtures/plugins/log-top-ts-versions-plugin/package.json b/test/fixtures/plugins/log-top-ts-versions-plugin/package.json new file mode 100644 index 0000000..b51d836 --- /dev/null +++ b/test/fixtures/plugins/log-top-ts-versions-plugin/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vs-compat-ts-plugin/log-top-ts-versions-plugin", + "version": "0.0.0", + "private": true +} \ No newline at end of file diff --git a/test/fixtures/plugins/logTsVersionsPlugin.js b/test/fixtures/plugins/log-ts-versions-plugin/index.js similarity index 100% rename from test/fixtures/plugins/logTsVersionsPlugin.js rename to test/fixtures/plugins/log-ts-versions-plugin/index.js diff --git a/test/fixtures/plugins/log-ts-versions-plugin/package.json b/test/fixtures/plugins/log-ts-versions-plugin/package.json new file mode 100644 index 0000000..23ed184 --- /dev/null +++ b/test/fixtures/plugins/log-ts-versions-plugin/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vs-compat-ts-plugin/log-ts-versions-plugin", + "version": "0.0.0", + "private": true +} \ No newline at end of file From 6cb62bcb22a15a0fa207f923355eb983c43018a9 Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Sun, 16 May 2021 03:16:07 +0100 Subject: [PATCH 3/8] test(deps): create workspace package.json for tests Moved fake plugin packages and various typescript versions to a package.json in the workspace. This is installed before running tests and means we can also include the main plugin by name --- package-lock.json | 44 ---------------------------- package.json | 12 ++------ test/fixtures/index.js | 10 +++---- test/fixtures/workspace/package.json | 17 +++++++++++ 4 files changed, 24 insertions(+), 59 deletions(-) create mode 100644 test/fixtures/workspace/package.json diff --git a/package-lock.json b/package-lock.json index b8b870c..d55773b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -479,26 +479,6 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, - "@vs-compat-ts-plugin/break-mock-require-plugin": { - "version": "file:test/fixtures/plugins/break-mock-require-plugin", - "dev": true - }, - "@vs-compat-ts-plugin/log-cwd-plugin": { - "version": "file:test/fixtures/plugins/log-cwd-plugin", - "dev": true - }, - "@vs-compat-ts-plugin/log-loadtime-cwd-plugin": { - "version": "file:test/fixtures/plugins/log-loadtime-cwd-plugin", - "dev": true - }, - "@vs-compat-ts-plugin/log-top-ts-versions-plugin": { - "version": "file:test/fixtures/plugins/log-top-ts-versions-plugin", - "dev": true - }, - "@vs-compat-ts-plugin/log-ts-versions-plugin": { - "version": "file:test/fixtures/plugins/log-ts-versions-plugin", - "dev": true - }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -8567,30 +8547,6 @@ "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true }, - "typescript": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", - "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", - "dev": true - }, - "typescript29": { - "version": "npm:typescript@2.9.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz", - "integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==", - "dev": true - }, - "typescript30": { - "version": "npm:typescript@3.0.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz", - "integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==", - "dev": true - }, - "typescript39": { - "version": "npm:typescript@3.9.9", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", - "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", - "dev": true - }, "uglify-js": { "version": "3.13.2", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.2.tgz", diff --git a/package.json b/package.json index ffab119..acf2a69 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "node": ">=10.14" }, "scripts": { + "pretest": "cd test/fixtures/workspace && npm install && cd ../../..", "test": "tape test/*.spec.js", "semantic-release": "semantic-release" }, @@ -35,20 +36,11 @@ "devDependencies": { "@semantic-release/changelog": "^5.0.1", "@semantic-release/git": "^9.0.0", - "@vs-compat-ts-plugin/break-mock-require-plugin": "file:test/fixtures/plugins/break-mock-require-plugin", - "@vs-compat-ts-plugin/log-cwd-plugin": "file:test/fixtures/plugins/log-cwd-plugin", - "@vs-compat-ts-plugin/log-loadtime-cwd-plugin": "file:test/fixtures/plugins/log-loadtime-cwd-plugin", - "@vs-compat-ts-plugin/log-top-ts-versions-plugin": "file:test/fixtures/plugins/log-top-ts-versions-plugin", - "@vs-compat-ts-plugin/log-ts-versions-plugin": "file:test/fixtures/plugins/log-ts-versions-plugin", "commitizen": "^4.2.0", "cz-conventional-changelog": "^3.2.0", "husky": "^4.2.5", "semantic-release": "^17.4.2", - "tape": "^5.0.1", - "typescript": "3.7.5", - "typescript29": "npm:typescript@2.9.1", - "typescript30": "npm:typescript@3.0.1", - "typescript39": "npm:typescript@3.9.9" + "tape": "^5.0.1" }, "dependencies": { "mock-require": "^3.0.3" diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 1b58d75..1acba98 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -3,7 +3,7 @@ const path = require('path'); module.exports = { THIS_PLUGIN: { name: 'vs-compat-ts-plugin', - path: path.resolve(__dirname, '..', '..', 'index.js'), + path: 'vs-compat-ts-plugin', namelessPath: '../index.js' // For loading the plugin without having the package name in the path }, LOG_CWD_PLUGIN: { @@ -23,14 +23,14 @@ module.exports = { }, TS_VERSIONS: { // Latest and oldest of each major release - '3.9': { version: '3.9.9', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript39') }, - '3.0': { version: '3.0.1', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript30') }, - '2.9': { version: '2.9.1', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript29') }, + '3.9': { version: '3.9.9', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript39') }, + '3.0': { version: '3.0.1', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript30') }, + '2.9': { version: '2.9.1', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript29') }, // Can't go back further than 2.8 because tsserver won't work on node 10 (https://github.com/microsoft/TypeScript/commit/1fc3aebc20a13048d6595395f721c6b0078c2c08) // Can't go back further than 2.9 because the tsconfig warnings stop appearing // Has to be a different version to all the others for the tsversion tests - 'default': { version: '3.7.5', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript') } + 'default': { version: '3.7.5', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript') } }, EMPTY_DIRS: [ path.resolve(__dirname, 'dirs', 'dir1'), diff --git a/test/fixtures/workspace/package.json b/test/fixtures/workspace/package.json new file mode 100644 index 0000000..696af59 --- /dev/null +++ b/test/fixtures/workspace/package.json @@ -0,0 +1,17 @@ +{ + "name": "@vs-compat-ts-plugin/test", + "version": "0.0.0", + "private": true, + "devDependencies": { + "@vs-compat-ts-plugin/break-mock-require-plugin": "file:../plugins/break-mock-require-plugin", + "@vs-compat-ts-plugin/log-cwd-plugin": "file:../plugins/log-cwd-plugin", + "@vs-compat-ts-plugin/log-loadtime-cwd-plugin": "file:../plugins/log-loadtime-cwd-plugin", + "@vs-compat-ts-plugin/log-top-ts-versions-plugin": "file:../plugins/log-top-ts-versions-plugin", + "@vs-compat-ts-plugin/log-ts-versions-plugin": "file:../plugins/log-ts-versions-plugin", + "typescript": "3.7.5", + "typescript29": "npm:typescript@2.9.1", + "typescript30": "npm:typescript@3.0.1", + "typescript39": "npm:typescript@3.9.9", + "vs-compat-ts-plugin": "file:../../.." + } +} From 66b89a517b75551a287fd647505b6d8d77ab5ebd Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Sun, 16 May 2021 03:38:47 +0100 Subject: [PATCH 4/8] feat(orderwarning): ignore plugins included by their local paths Newer versions of TS only allow plugins to be specified by package name. Dropped the tests and the code for guessing when the plugin is included via a local path. This will make no difference to anyone using the plugin normally via npm, and won't make any difference to properly set up projects. --- src/orderwarning.js | 2 +- test/fixtures/index.js | 2 +- test/orderwarning.spec.js | 48 +++++---------------------------------- 3 files changed, 8 insertions(+), 44 deletions(-) diff --git a/src/orderwarning.js b/src/orderwarning.js index c7b4838..729650b 100644 --- a/src/orderwarning.js +++ b/src/orderwarning.js @@ -30,7 +30,7 @@ function getThisPluginNode(ts, pluginsArrayNode) { return false; } const nameAssignments = getChildren(node, false, ts.SyntaxKind.PropertyAssignment).filter(node => node.name.text === 'name') - return nameAssignments.some(node => node.initializer.kind === ts.SyntaxKind.StringLiteral && /(^|\\|\/)vs-compat-ts-plugin($|\\|\/)/.test(node.initializer.text)); + return nameAssignments.some(node => node.initializer.kind === ts.SyntaxKind.StringLiteral && node.initializer.text === 'vs-compat-ts-plugin'); })[0]; } diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 1acba98..06296fd 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -4,7 +4,7 @@ module.exports = { THIS_PLUGIN: { name: 'vs-compat-ts-plugin', path: 'vs-compat-ts-plugin', - namelessPath: '../index.js' // For loading the plugin without having the package name in the path + namelessPath: '../../../../../index.js' // For loading the plugin without having the package name in the path }, LOG_CWD_PLUGIN: { name: 'logCwdPlugin', path: '@vs-compat-ts-plugin/log-cwd-plugin' diff --git a/test/orderwarning.spec.js b/test/orderwarning.spec.js index fd8d1ed..b4646f1 100644 --- a/test/orderwarning.spec.js +++ b/test/orderwarning.spec.js @@ -25,8 +25,7 @@ pluginTest('should log but not warn if plugin cannot be found in the list', { pluginTest('should warn when something precedes this plugin in plugins list', { plugins: [ { name: 'other-plugin' }, - { name: THIS_PLUGIN.name }, - { name: THIS_PLUGIN.namelessPath } + { name: THIS_PLUGIN.name } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses }) => { @@ -39,8 +38,7 @@ pluginTest('should warn when something precedes this plugin in plugins list', { pluginTest('should not warn when this plugin is first in plugins list', { plugins: [ { name: THIS_PLUGIN.name }, - { name: 'other-plugin' }, - { name: THIS_PLUGIN.namelessPath } + { name: 'other-plugin' } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses }) => { @@ -52,8 +50,7 @@ pluginTest('should not warn when this plugin is first in plugins list', { pluginTest('should not warn when found outside the normal plugins list', { plugins: [ { name: THIS_PLUGIN.name }, - { name: 'other-plugin', config: { plugins: [{ name: THIS_PLUGIN.name }] } }, - { name: THIS_PLUGIN.namelessPath } + { name: 'other-plugin', config: { plugins: [{ name: THIS_PLUGIN.name }] } } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses }) => { @@ -65,8 +62,7 @@ pluginTest('should not warn when found outside the normal plugins list', { pluginTest('should mark error across the whole plugin def object in the source', { plugins: [ { name: 'other-plugin' }, - { name: THIS_PLUGIN.name }, - { name: THIS_PLUGIN.namelessPath } + { name: THIS_PLUGIN.name } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses }) => { @@ -83,8 +79,7 @@ pluginTest('should mark error across the whole plugin def object in the source', pluginTest('should be warning with a sensible message', { plugins: [ { name: 'other-plugin' }, - { name: THIS_PLUGIN.name }, - { name: THIS_PLUGIN.namelessPath } + { name: THIS_PLUGIN.name } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses }) => { @@ -99,36 +94,7 @@ pluginTest('should be warning with a sensible message', { pluginTest('should find the plugin by its package name', { plugins: [ { name: 'other-plugin' }, - { name: THIS_PLUGIN.name }, - { name: THIS_PLUGIN.namelessPath } - ], - serverCommands: getTsConfigDiagnostics, - check: (t, { responses }) => { - t.ok(responses[0].success); - t.equal(responses[0].body.length, 1); - t.equal(responses[0].body[0].code, EXPECTED_ERROR_CODE); - } -}); - -pluginTest('should find the plugin in local paths', { - plugins: [ - { name: 'other-plugin' }, - { name: path.join('..', THIS_PLUGIN.name) }, - { name: THIS_PLUGIN.namelessPath } - ], - serverCommands: getTsConfigDiagnostics, - check: (t, { responses }) => { - t.ok(responses[0].success); - t.equal(responses[0].body.length, 1); - t.equal(responses[0].body[0].code, EXPECTED_ERROR_CODE); - } -}); - -pluginTest('should find the plugin when requesting a specific file', { - plugins: [ - { name: 'other-plugin' }, - { name: path.join(THIS_PLUGIN.name, 'index.js') }, - { name: THIS_PLUGIN.namelessPath } + { name: THIS_PLUGIN.name } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses }) => { @@ -140,7 +106,6 @@ pluginTest('should find the plugin when requesting a specific file', { pluginTest('should not find the plugin when it appears in another plugin name', { plugins: [ - { name: THIS_PLUGIN.namelessPath }, { name: 'not-vs-compat-ts-plugin' } ], serverCommands: getTsConfigDiagnostics, @@ -154,7 +119,6 @@ pluginTest('should be ok with the plugin appearing twice if one comes first', { plugins: [ { name: THIS_PLUGIN.name }, { name: THIS_PLUGIN.name }, - { name: THIS_PLUGIN.namelessPath } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses }) => { From 662abfcdbefdb84ade2b811b8e7cdbf0aaf7c4c4 Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Sun, 16 May 2021 03:50:26 +0100 Subject: [PATCH 5/8] test(orderwarning): fix orderwarning tests for newer TS versions Since we cannot load the plugin by filepath in newer TS versions, and we can't alias a package from a local path, it's hard to install the plugin with a different name and generate warnings in the tests. Added it awkwardly as a new name todo this. --- test/fixtures/index.js | 2 +- test/fixtures/workspace/package.json | 3 ++- test/orderwarning.spec.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 06296fd..31d9c98 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -4,7 +4,7 @@ module.exports = { THIS_PLUGIN: { name: 'vs-compat-ts-plugin', path: 'vs-compat-ts-plugin', - namelessPath: '../../../../../index.js' // For loading the plugin without having the package name in the path + alias: '@vs-compat-ts-plugin/this' }, LOG_CWD_PLUGIN: { name: 'logCwdPlugin', path: '@vs-compat-ts-plugin/log-cwd-plugin' diff --git a/test/fixtures/workspace/package.json b/test/fixtures/workspace/package.json index 696af59..f51e32e 100644 --- a/test/fixtures/workspace/package.json +++ b/test/fixtures/workspace/package.json @@ -12,6 +12,7 @@ "typescript29": "npm:typescript@2.9.1", "typescript30": "npm:typescript@3.0.1", "typescript39": "npm:typescript@3.9.9", - "vs-compat-ts-plugin": "file:../../.." + "vs-compat-ts-plugin": "file:../../..", + "@vs-compat-ts-plugin/this": "file:../../.." } } diff --git a/test/orderwarning.spec.js b/test/orderwarning.spec.js index b4646f1..75b2c12 100644 --- a/test/orderwarning.spec.js +++ b/test/orderwarning.spec.js @@ -12,7 +12,7 @@ function getTsConfigDiagnostics(server) { pluginTest('should log but not warn if plugin cannot be found in the list', { plugins: [ { name: 'other-plugin' }, - { name: THIS_PLUGIN.namelessPath } + { name: THIS_PLUGIN.alias } ], serverCommands: getTsConfigDiagnostics, check: (t, { responses, hasMessageBy }) => { From df9f35d5543e3b0fdcd13a7532a9e8d2b0574691 Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Sun, 16 May 2021 03:57:38 +0100 Subject: [PATCH 6/8] test(typescript): test against TS 4.x --- test/fixtures/index.js | 2 ++ test/fixtures/workspace/package.json | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 31d9c98..efb1dd3 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -23,6 +23,8 @@ module.exports = { }, TS_VERSIONS: { // Latest and oldest of each major release + '4.2': { version: '4.2.4', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript42') }, + '4.0': { version: '4.0.7', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript40') }, '3.9': { version: '3.9.9', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript39') }, '3.0': { version: '3.0.1', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript30') }, '2.9': { version: '2.9.1', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript29') }, diff --git a/test/fixtures/workspace/package.json b/test/fixtures/workspace/package.json index f51e32e..b3ef3f7 100644 --- a/test/fixtures/workspace/package.json +++ b/test/fixtures/workspace/package.json @@ -8,11 +8,13 @@ "@vs-compat-ts-plugin/log-loadtime-cwd-plugin": "file:../plugins/log-loadtime-cwd-plugin", "@vs-compat-ts-plugin/log-top-ts-versions-plugin": "file:../plugins/log-top-ts-versions-plugin", "@vs-compat-ts-plugin/log-ts-versions-plugin": "file:../plugins/log-ts-versions-plugin", + "@vs-compat-ts-plugin/this": "file:../../..", "typescript": "3.7.5", "typescript29": "npm:typescript@2.9.1", "typescript30": "npm:typescript@3.0.1", "typescript39": "npm:typescript@3.9.9", - "vs-compat-ts-plugin": "file:../../..", - "@vs-compat-ts-plugin/this": "file:../../.." + "typescript40": "npm:typescript@4.0.7", + "typescript42": "npm:typescript@4.2.4", + "vs-compat-ts-plugin": "file:../../.." } } From a2db67342a1d9fb7ddb8c5112ad62e63c5e63410 Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Sun, 16 May 2021 21:11:04 +0100 Subject: [PATCH 7/8] test(log): better logging for tests that fail log content checks --- test/cwd.spec.js | 28 ++++++++++++++-------------- test/defaults.spec.js | 16 ++++++++-------- test/helpers.js | 17 +++++++++++++++-- test/orderwarning.spec.js | 4 ++-- test/plugin.spec.js | 4 ++-- test/tsversion.spec.js | 24 ++++++++++++------------ 6 files changed, 53 insertions(+), 40 deletions(-) diff --git a/test/cwd.spec.js b/test/cwd.spec.js index 03c0fd1..6dc7e30 100644 --- a/test/cwd.spec.js +++ b/test/cwd.spec.js @@ -11,8 +11,8 @@ pluginTest('cwd is set before the next plugin init', { { name: THIS_PLUGIN.path, workingDirectory: PLUGIN_CWD }, { name: LOG_CWD_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(LOG_CWD_PLUGIN.name, PLUGIN_CWD)); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(LOG_CWD_PLUGIN.name, PLUGIN_CWD); } }); @@ -22,8 +22,8 @@ pluginTest('cwd is set before the next plugin is loaded', { { name: THIS_PLUGIN.path, workingDirectory: PLUGIN_CWD }, { name: LOG_LOADTIME_CWD_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(LOG_LOADTIME_CWD_PLUGIN.name, PLUGIN_CWD)); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(LOG_LOADTIME_CWD_PLUGIN.name, PLUGIN_CWD); } }); @@ -33,8 +33,8 @@ pluginTest('cwd not changed when null', { { name: THIS_PLUGIN.path, workingDirectory: null }, { name: LOG_CWD_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(LOG_CWD_PLUGIN.name, SERVER_CWD)); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(LOG_CWD_PLUGIN.name, SERVER_CWD); } }); @@ -44,10 +44,10 @@ pluginTest('invalid cwd does not break everything else', { { name: THIS_PLUGIN.path, workingDirectory: '/\\not.*valid' }, { name: LOG_CWD_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Could not set working directory')); - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Meddling completed')); - t.ok(hasMessageBy(LOG_CWD_PLUGIN.name, SERVER_CWD)); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(THIS_PLUGIN.name, 'Could not set working directory'); + assertHasMessageBy(THIS_PLUGIN.name, 'Meddling completed'); + assertHasMessageBy(LOG_CWD_PLUGIN.name, SERVER_CWD); } }); @@ -57,8 +57,8 @@ pluginTest('cwd relative to the tsconfig directory', { { name: THIS_PLUGIN.path, workingDirectory: RELATIVE_PLUGIN_CWD }, { name: LOG_CWD_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(LOG_CWD_PLUGIN.name, PLUGIN_CWD)); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(LOG_CWD_PLUGIN.name, PLUGIN_CWD); } }); @@ -68,7 +68,7 @@ pluginTest('cwd can use forward slashes (in all OS)', { { name: THIS_PLUGIN.path, workingDirectory: RELATIVE_PLUGIN_CWD.replace(/\\/g, '/') }, { name: LOG_CWD_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(LOG_CWD_PLUGIN.name, PLUGIN_CWD)); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(LOG_CWD_PLUGIN.name, PLUGIN_CWD); } }); diff --git a/test/defaults.spec.js b/test/defaults.spec.js index 1eaa5af..1e06027 100644 --- a/test/defaults.spec.js +++ b/test/defaults.spec.js @@ -5,8 +5,8 @@ pluginTest('cwd set to . by default', { plugins: [ { name: THIS_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(THIS_PLUGIN.name, `Updating cwd to ${PROJECT_DIR}`)); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(THIS_PLUGIN.name, `Updating cwd to ${PROJECT_DIR}`); } }); @@ -14,8 +14,8 @@ pluginTest('typescript mocked by default', { plugins: [ { name: THIS_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Mocking typescript module with the version from tsserver')); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(THIS_PLUGIN.name, 'Mocking typescript module with the version from tsserver'); } }); @@ -23,9 +23,9 @@ pluginTest('default to off if onByDefault is set off', { plugins: [ { name: THIS_PLUGIN.path, onByDefault: false } ], - check: (t, { hasMessageBy, messagesBy }) => { + check: (t, { assertNotHasMessageBy, messagesBy }) => { t.notOk(messagesBy(THIS_PLUGIN.name).some(msg => /Updating cwd/.test(msg))); - t.notOk(hasMessageBy(THIS_PLUGIN.name, 'Mocking typescript module with the version from tsserver')); + assertNotHasMessageBy(THIS_PLUGIN.name, 'Mocking typescript module with the version from tsserver'); } }); @@ -33,8 +33,8 @@ pluginTest('default to on if onByDefault is set on', { plugins: [ { name: THIS_PLUGIN.path, onByDefault: true } ], - check: (t, { hasMessageBy, messagesBy }) => { + check: (t, { assertHasMessageBy, messagesBy }) => { t.ok(messagesBy(THIS_PLUGIN.name).some(msg => /Updating cwd/.test(msg))); - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Mocking typescript module with the version from tsserver')); + assertHasMessageBy(THIS_PLUGIN.name, 'Mocking typescript module with the version from tsserver'); } }); \ No newline at end of file diff --git a/test/helpers.js b/test/helpers.js index c69aeff..d1aef35 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -49,9 +49,22 @@ function pluginTest(testName, { serverCwd, plugins, serverCommands, check }, onl const logContent = fs.readFileSync(LOG_FILE).toString(); const responses = server.responses; const messagesBy = getMessagesBy(logContent); - const hasMessageBy = (plugin, msg) => messagesBy(plugin).indexOf(msg) !== -1; + const assertHasMessageBy = (plugin, msg) => { + const hasMessageBy = messagesBy(plugin).indexOf(msg) !== -1; + if(!hasMessageBy) { + t.comment(logContent); + } + t.ok(hasMessageBy); + }; + const assertNotHasMessageBy = (plugin, msg) => { + const hasMessageBy = messagesBy(plugin).indexOf(msg) !== -1; + if(hasMessageBy) { + t.comment(logContent); + } + t.notOk(hasMessageBy); + }; - check(t, { logContent, responses, messagesBy, hasMessageBy, tsVersion }); + check(t, { logContent, responses, messagesBy, assertHasMessageBy, assertNotHasMessageBy, tsVersion }); } catch(err) { t.fail('Server failed to run: ' + err.toString()); diff --git a/test/orderwarning.spec.js b/test/orderwarning.spec.js index 75b2c12..3f38b92 100644 --- a/test/orderwarning.spec.js +++ b/test/orderwarning.spec.js @@ -15,8 +15,8 @@ pluginTest('should log but not warn if plugin cannot be found in the list', { { name: THIS_PLUGIN.alias } ], serverCommands: getTsConfigDiagnostics, - check: (t, { responses, hasMessageBy }) => { - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Could not find the plugin in the project plugin list')); + check: (t, { responses, assertHasMessageBy }) => { + assertHasMessageBy(THIS_PLUGIN.name, 'Could not find the plugin in the project plugin list'); t.ok(responses[0].success); t.equal(responses[0].body.length, 0); } diff --git a/test/plugin.spec.js b/test/plugin.spec.js index 1055110..87f1905 100644 --- a/test/plugin.spec.js +++ b/test/plugin.spec.js @@ -5,7 +5,7 @@ pluginTest('loads successfully', { plugins: [ { name: THIS_PLUGIN.path } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Loaded plugin')); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(THIS_PLUGIN.name, 'Loaded plugin'); } }); \ No newline at end of file diff --git a/test/tsversion.spec.js b/test/tsversion.spec.js index 7df871d..6028fc9 100644 --- a/test/tsversion.spec.js +++ b/test/tsversion.spec.js @@ -16,9 +16,9 @@ pluginTest('typescript not mocked if useVSTypescript is false', { { name: THIS_PLUGIN.path, useVSTypescript: false }, { name: LOG_TS_VERSIONS_PLUGIN.path } ], - check: (t, { hasMessageBy, tsVersion }) => { - t.ok(hasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `required: ${TS_VERSIONS.default.version}`)); - t.ok(hasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `plugin: ${tsVersion.version}`)); + check: (t, { assertHasMessageBy, tsVersion }) => { + assertHasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `required: ${TS_VERSIONS.default.version}`); + assertHasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `plugin: ${tsVersion.version}`); } }); @@ -27,9 +27,9 @@ pluginTest('typescript is mocked if useVSTypescript is true', { { name: THIS_PLUGIN.path, useVSTypescript: true }, { name: LOG_TS_VERSIONS_PLUGIN.path } ], - check: (t, { hasMessageBy, tsVersion }) => { - t.ok(hasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `required: ${tsVersion.version}`)); - t.ok(hasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `plugin: ${tsVersion.version}`)); + check: (t, { assertHasMessageBy, tsVersion }) => { + assertHasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `required: ${tsVersion.version}`); + assertHasMessageBy(LOG_TS_VERSIONS_PLUGIN.name, `plugin: ${tsVersion.version}`); } }); @@ -38,9 +38,9 @@ pluginTest('typescript is mocked even at the top level of other plugins if useVS { name: THIS_PLUGIN.path, useVSTypescript: true }, { name: LOG_TOP_TS_VERSIONS_PLUGIN.path } ], - check: (t, { hasMessageBy, tsVersion }) => { - t.ok(hasMessageBy(LOG_TOP_TS_VERSIONS_PLUGIN.name, `required: ${tsVersion.version}`)); - t.ok(hasMessageBy(LOG_TOP_TS_VERSIONS_PLUGIN.name, `plugin: ${tsVersion.version}`)); + check: (t, { assertHasMessageBy, tsVersion }) => { + assertHasMessageBy(LOG_TOP_TS_VERSIONS_PLUGIN.name, `required: ${tsVersion.version}`); + assertHasMessageBy(LOG_TOP_TS_VERSIONS_PLUGIN.name, `plugin: ${tsVersion.version}`); } }); @@ -49,8 +49,8 @@ pluginTest('failed typescript mock does not break the plugin', { { name: BREAK_MOCK_REQUIRE_PLUGIN.path }, { name: THIS_PLUGIN.path, useVSTypescript: true } ], - check: (t, { hasMessageBy }) => { - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Could not mock typescript')); - t.ok(hasMessageBy(THIS_PLUGIN.name, 'Meddling completed')); + check: (t, { assertHasMessageBy }) => { + assertHasMessageBy(THIS_PLUGIN.name, 'Could not mock typescript'); + assertHasMessageBy(THIS_PLUGIN.name, 'Meddling completed'); } }); \ No newline at end of file From dd5ab70584e4fe4346429cfc67fa1e21d76903bc Mon Sep 17 00:00:00 2001 From: Andy Gurden <420834+andyrooger@users.noreply.github.com> Date: Mon, 17 May 2021 01:25:52 +0100 Subject: [PATCH 8/8] test(deps): adjust test dep locations to work with local packages Moved the default TS dependency to the project root to work around issues with packages that have peer deps being installed as local folders. Adjusted stored paths to compensate. Included TS as a peer dep for the dummy plugins that need it. --- package-lock.json | 6 ++++++ package.json | 3 ++- test/TestServer.js | 2 +- test/fixtures/index.js | 2 +- .../plugins/log-top-ts-versions-plugin/package.json | 5 ++++- test/fixtures/plugins/log-ts-versions-plugin/package.json | 5 ++++- test/fixtures/workspace/package.json | 1 - 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index d55773b..c970674 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8547,6 +8547,12 @@ "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true }, + "typescript": { + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", + "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "dev": true + }, "uglify-js": { "version": "3.13.2", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.2.tgz", diff --git a/package.json b/package.json index acf2a69..e4fe6b2 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ "cz-conventional-changelog": "^3.2.0", "husky": "^4.2.5", "semantic-release": "^17.4.2", - "tape": "^5.0.1" + "tape": "^5.0.1", + "typescript": "^3.7.5" }, "dependencies": { "mock-require": "^3.0.3" diff --git a/test/TestServer.js b/test/TestServer.js index 60adbf1..9020f28 100644 --- a/test/TestServer.js +++ b/test/TestServer.js @@ -9,7 +9,7 @@ class TestServer { const tsServerDir = typescriptServerDir || path.join(__dirname, '..', 'node_modules', 'typescript') const tsserverPath = path.join(tsServerDir, 'lib', 'tsserver'); const server = fork(tsserverPath, [ - '--pluginProbeLocations', path.join(__dirname, '..'), + '--pluginProbeLocations', path.join(tsServerDir, '..'), '--logFile', logFile, '--logVerbosity', 'info', '--disableAutomaticTypingAcquisition' diff --git a/test/fixtures/index.js b/test/fixtures/index.js index efb1dd3..b1786bd 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -32,7 +32,7 @@ module.exports = { // Can't go back further than 2.9 because the tsconfig warnings stop appearing // Has to be a different version to all the others for the tsversion tests - 'default': { version: '3.7.5', path: path.resolve(__dirname, 'workspace', 'node_modules', 'typescript') } + 'default': { version: '3.7.5', path: path.resolve(__dirname, '..', '..', 'node_modules', 'typescript') } }, EMPTY_DIRS: [ path.resolve(__dirname, 'dirs', 'dir1'), diff --git a/test/fixtures/plugins/log-top-ts-versions-plugin/package.json b/test/fixtures/plugins/log-top-ts-versions-plugin/package.json index b51d836..2cbc46b 100644 --- a/test/fixtures/plugins/log-top-ts-versions-plugin/package.json +++ b/test/fixtures/plugins/log-top-ts-versions-plugin/package.json @@ -1,5 +1,8 @@ { "name": "@vs-compat-ts-plugin/log-top-ts-versions-plugin", "version": "0.0.0", - "private": true + "private": true, + "peerDependencies": { + "typescript": "*" + } } \ No newline at end of file diff --git a/test/fixtures/plugins/log-ts-versions-plugin/package.json b/test/fixtures/plugins/log-ts-versions-plugin/package.json index 23ed184..6fbb43d 100644 --- a/test/fixtures/plugins/log-ts-versions-plugin/package.json +++ b/test/fixtures/plugins/log-ts-versions-plugin/package.json @@ -1,5 +1,8 @@ { "name": "@vs-compat-ts-plugin/log-ts-versions-plugin", "version": "0.0.0", - "private": true + "private": true, + "peerDependencies": { + "typescript": "*" + } } \ No newline at end of file diff --git a/test/fixtures/workspace/package.json b/test/fixtures/workspace/package.json index b3ef3f7..f3c885f 100644 --- a/test/fixtures/workspace/package.json +++ b/test/fixtures/workspace/package.json @@ -9,7 +9,6 @@ "@vs-compat-ts-plugin/log-top-ts-versions-plugin": "file:../plugins/log-top-ts-versions-plugin", "@vs-compat-ts-plugin/log-ts-versions-plugin": "file:../plugins/log-ts-versions-plugin", "@vs-compat-ts-plugin/this": "file:../../..", - "typescript": "3.7.5", "typescript29": "npm:typescript@2.9.1", "typescript30": "npm:typescript@3.0.1", "typescript39": "npm:typescript@3.9.9",