From eb6e3ab7f75974b50c8e98fe017eae1f2f503fe3 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 26 May 2019 12:43:33 -0700 Subject: [PATCH] Fix tests on Windows (hopefully) --- bin/test.js | 17 +++++++++++++++++ package.json | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 bin/test.js diff --git a/bin/test.js b/bin/test.js new file mode 100644 index 00000000..3c682fa1 --- /dev/null +++ b/bin/test.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2019 The xterm.js authors. All rights reserved. + * @license MIT + */ + +const cp = require('child_process'); +const path = require('path'); + +// Add `out` to the NODE_PATH so absolute paths can be resolved. +const env = { ...process.env }; +env.NODE_PATH = path.resolve(__dirname, '../out'); + +cp.spawnSync('yarn', ['mocha'], { + cwd: path.join(__dirname, '..'), + stdio: 'inherit', + env +}); diff --git a/package.json b/package.json index 16ab186e..95fdeb3e 100644 --- a/package.json +++ b/package.json @@ -58,11 +58,11 @@ "start-debug": "node --inspect-brk demo/start", "start-zmodem": "node demo/zmodem/app", "lint": "tslint 'src/**/*.ts' './demo/**/*.ts'", - "test": "npm run mocha", + "test": "node ./bin/test.js", "posttest": "npm run lint", "test-coverage": "nyc -x gulpfile.js -x '**/*test*' npm run mocha", "test-api": "mocha \"**/*.api.js\"", - "mocha": "NODE_PATH=$(pwd)/out gulp test", + "mocha": "gulp test", "prebuild": "tsc -b ./src/tsconfig.all.json", "build": "gulp build", "prepare": "npm run prebuild",