dolittle-obsolete / TypeScript.Webpack.Aurelia

Dolittle TypeScript Webpack configuration for Aurelia projects
0 stars 0 forks source link

Getting wallaby and mocha testing working in an aurelia /typescript project #1

Open pavsaund opened 4 years ago

pavsaund commented 4 years ago

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.

pavsaund commented 4 years ago

The most pressing issues are the two for the mocha setup (ignored files and including dependencies), since these don't have any local workarounds