Skip to content
Permalink
Browse files

Fix serialize-error tests on Windows with GitHub Actions

GitHub Actions runs the tests from a different drive than where the temp
files are located. Create a temporary directory on the same drive to
ensure an otherwise failing tests passes.
  • Loading branch information...
novemberborn committed Sep 1, 2019
1 parent 53d7fe1 commit fb0c536052ade674c58f74c3f54ec6e312ee6478
Showing with 13 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +12 −1 test/serialize-error.js
@@ -2,3 +2,4 @@ node_modules
.nyc_output
coverage
bench/.results
test/.tmpdir
@@ -4,6 +4,7 @@ require('../lib/worker/options').set({});

const fs = require('fs');
const path = require('path');
const makeDir = require('make-dir');
const sourceMapFixtures = require('source-map-fixtures');
const sourceMapSupport = require('source-map-support');
const tempWrite = require('temp-write');
@@ -18,6 +19,16 @@ const serialize = error => serializeError('Test', true, error);
// Needed to test stack traces from source map fixtures.
sourceMapSupport.install({environment: 'node'});

const makeTempDir = () => {
if (process.platform !== 'win32') {
return uniqueTempDir({create: true});
}

const dir = path.join(__dirname, '.tmpdir', `serialize-error.${process.pid}`);
makeDir.sync(dir);
return dir;
};

test('serialize standard props', t => {
const error = new Error('Hello');
const serializedError = serialize(error);
@@ -67,7 +78,7 @@ test('source file is an absolute path, after source map correction, even if alre
const fixture = sourceMapFixtures.mapFile('throws');
const map = JSON.parse(fs.readFileSync(fixture.file + '.map'));

const tmp = uniqueTempDir({create: true});
const tmp = makeTempDir();
const sourceRoot = path.join(tmp, 'src');
const expectedSourceFile = path.join(sourceRoot, map.file);

0 comments on commit fb0c536

Please sign in to comment.
You can’t perform that action at this time.