Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"module": "node",
"scripts": {
"test:coverage": "nyc --reporter=text mocha --reporter spec './{,!(node_modules)/**/}*.spec.js'",
"test": "mocha --require ejsify --require jsdom-global/register --reporter spec './{,!(node_modules)/**/}*.spec.ts'",
"test": "mocha --require jsdom-global/register --reporter spec './{,!(node_modules)/**/}*.spec.ts'",
"watch": "tsc -w",
"webpack:dev": "webpack",
"webpack:prod": "webpack --config webpack.prod.js",
Expand Down Expand Up @@ -43,13 +43,10 @@
"devDependencies": {
"@formio/js": "5.0.0-rc.76",
"@types/chai": "^4.2.11",
"@types/ejs": "^3.0.2",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.5",
"@types/sinon": "^10.0.13",
"chai": "^4.2.0",
"ejs": "^3.1.10",
"ejsify": "^1.0.0",
"esm": "^3.2.25",
"eventemitter3": "^5.0.1",
"gulp": "^4.0.2",
Expand All @@ -62,6 +59,7 @@
"mocha": "^10.2.0",
"native-promise-only": "^0.8.1",
"nyc": "^15.0.1",
"pirates": "^4.0.6",
"pre-commit": "^1.2.2",
"sass": "^1.59.3",
"sinon": "^15.0.2",
Expand Down
18 changes: 15 additions & 3 deletions register.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
const _ = require('lodash');
const pirates = require('pirates');

/**
* Overrides the tsconfig used for the app.
* In the test environment we need some tweaks.
*/

const tsNode = require('ts-node');
const tsNode = require('ts-node');

tsNode.register({
tsNode.register({
files: true,
transpileOnly: true,
project: './tsconfig.spec.json'
});
});

pirates.addHook((code) => {
return 'export default ' + _.template(code, {
evaluate: /\{%([\s\S]+?)%\}/g,
interpolate: /\{\{([\s\S]+?)\}\}/g,
escape: /\{\{\{([\s\S]+?)\}\}\}/g,
variable: 'ctx'
});
}, { exts: ['.ejs'] });
Loading