Open connor4312 opened 1 year ago
Webpack removes the need to glob for files, but a bundled file that requires test env CLI cannot be used with this package:
runTests
to execute the code
CLI with special arguments and expose require('vscode')
.runTests.ts
file.Ideally the core repo needs to add CLI argument for an absolute bin path to wrap the script JS.
Yea, webpack would, though we would dislike 'hardcoding' to a single bundler. And I myself prefer esbuild for my extensions 🙂 There are solutions there too, of course, but the question is whether we want to maintain a list of instructions/plugins needed for each bundler (which is sure to change over time)
Fwiw there is now bleeding edge BDD test closures shipped with node - Test runner (NodeJS).
It's not on the same version that VS Code ships with unfortunately, but yeah.
I’m trying to understand this problem. Is this correct?
There are integration tests. These tests run test actual behaviour based on the generated bundle that ships with the VSCode extension. These do not require access to the source code. These integration tests are often written in TypeScript, but compiled and run as JavaScript. There’s no need to bundle tests for this.
There are unittests. These test the source code on a lower level. Both the unittests and source code are often written in TypeScript, but compiled and run as JavaScript.
This means tests need a compilation step which is different from the build step.
So the real problem is extension tests can’t run TypeScript code, right?
I imagine the ideal situation would be that the user just needs to write a standard test file, run code-test
, and everything just works.
I think this is possible by:
I have a working test suite that scales to Node and Web in a platform-independent manner:
webpack
library bundling - webpack.config.js
tsconfig
for node test compilation tsconfig.test.json
webpack
web test bundling - webpack.config.web.test.js
runTests
pattern) and runner (suite index) for node+web - see ./test
./test/suite
Currently our standard test setup is using mocha and globbing for files. This doesn't work well with bundlers like esbuild or webpack. There are hacks to allow star imports in both these bundlers, but ideally we could figure some less-intrusive way to deal with these.