I've been struggling to get typescript testing up and running in our aurelia project, and have hit several hurdles that could be made easier by the build / tooling pipeline. Some have been fixed locally, while others need changes to the underlying tools pipeline to make them work.
wallaby.config.js with workarounds
```diff
const build = require('@dolittle/typescript.build');
module.exports = build.wallaby((wallaby, settings) => {
settings.compilers = {
'**/*.@(js|ts)': wallaby.compilers.typeScript({
module: 'commonjs',
downlevelIteration: true,
allowJs: true,
experimentalDecorators: true,
esModuleInterop: true,
+ outDir: './any', // fix to make js files available for the typescript transpiler in wallaby
target: 'es6'
})
}
+ // fix to transpile js files in wallaby
+ settings.preprocessors = {
+ '**/*.jsts': file => file.changeExt('js').content
+ }
+ // Fix to ignore a local custom folder
+ settings.files.push({ pattern: 'aurelia_project/**/*', ignore: true});
+}, (wallaby, setup) => {
+ // Fix to be able to test aurelia components using ex: decorators
+ require('aurelia-polyfills');
+});
```
These could be then made into three issues:
Add support / setting to allow mixed js/ts compilation in wallaby (since dolittle proxies are still js)
Add mechanism for wallaby setup to respect ignored files in ex: tsconfig
Add the aurelia-polyfills package automatically - since it's required for testing
Mocha
Hitting several similar issues with mocha-testing, but without a good long-term workaround. The biggest issue has been to be able to build the project, which failed due to a bugfix in typescript 3.7, which aurelia-vaildation needs to fix.
Local fix is to lock typescript dependency used by the build package like so:
It would be convenient if the used typescript was forced to 3.6.x by the TypeScript.Webpack.Aurelia-package, so that it can be fixed for all projects using this combination.
Mechanism for mocha setup to respect ignored/excluded files in ex: tsconfig - No workaround
Mechanism to support adding required test dependencies ex aurelia-polyfills - No workaround
Lock version of typescript to 3.6.X while aurelia-validation fixes their bugs (perhaps this is a project-specific fix?)
I've been struggling to get typescript testing up and running in our aurelia project, and have hit several hurdles that could be made easier by the build / tooling pipeline. Some have been fixed locally, while others need changes to the underlying tools pipeline to make them work.
Wallaby
Based on a lot of ping-ponging: I got wallaby working based on what you see in this repository: https://github.com/pavsaund/wallaby-dolittle-aurelia-mixed-js-ts
wallaby.config.js with workarounds
```diff const build = require('@dolittle/typescript.build'); module.exports = build.wallaby((wallaby, settings) => { settings.compilers = { '**/*.@(js|ts)': wallaby.compilers.typeScript({ module: 'commonjs', downlevelIteration: true, allowJs: true, experimentalDecorators: true, esModuleInterop: true, + outDir: './any', // fix to make js files available for the typescript transpiler in wallaby target: 'es6' }) } + // fix to transpile js files in wallaby + settings.preprocessors = { + '**/*.jsts': file => file.changeExt('js').content + } + // Fix to ignore a local custom folder + settings.files.push({ pattern: 'aurelia_project/**/*', ignore: true}); +}, (wallaby, setup) => { + // Fix to be able to test aurelia components using ex: decorators + require('aurelia-polyfills'); +}); ```These could be then made into three issues:
Mocha
Hitting several similar issues with mocha-testing, but without a good long-term workaround. The biggest issue has been to be able to build the project, which failed due to a bugfix in typescript 3.7, which aurelia-vaildation needs to fix.
Local fix is to lock typescript dependency used by the build package like so:
package.json workaround
```json { ... "resolutions": { "@dolittle/typescript.build/typescript": "^3.6.4" }, ... } ```It would be convenient if the used typescript was forced to 3.6.x by the TypeScript.Webpack.Aurelia-package, so that it can be fixed for all projects using this combination.