Skip to content

Commit

Permalink
fix(test): fix writeFileSync on newer node versions
Browse files Browse the repository at this point in the history
fs.writeFileSync no longer stringifies arguments, instead throwing if it
receives something that is not a proper String or Buffer.
  • Loading branch information
isaacs committed Aug 31, 2021
1 parent c41333d commit 121090f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function createMultiLineSourceMapWithSourcesContent() {

function compareStackTrace(sourceMap, source, expected) {
// Check once with a separate source map
fs.writeFileSync('.generated.js.map', sourceMap);
fs.writeFileSync('.generated.js.map', String(sourceMap));
fs.writeFileSync('.generated.js', 'exports.test = function() {' +
source.join('\n') + '};//@ sourceMappingURL=.generated.js.map');
try {
Expand All @@ -113,7 +113,7 @@ function compareStackTrace(sourceMap, source, expected) {

function compareStdout(done, sourceMap, source, expected) {
fs.writeFileSync('.original.js', 'this is the original code');
fs.writeFileSync('.generated.js.map', sourceMap);
fs.writeFileSync('.generated.js.map', String(sourceMap));
fs.writeFileSync('.generated.js', source.join('\n') +
'//@ sourceMappingURL=.generated.js.map');
child_process.exec('node ./.generated', function(error, stdout, stderr) {
Expand Down Expand Up @@ -616,7 +616,7 @@ it('handleUncaughtExceptions is true with existing listener', function(done) {
];

fs.writeFileSync('.original.js', 'this is the original code');
fs.writeFileSync('.generated.js.map', createSingleLineSourceMap());
fs.writeFileSync('.generated.js.map', String(createSingleLineSourceMap()));
fs.writeFileSync('.generated.js', source.join('\n'));

child_process.exec('node ./.generated', function(error, stdout, stderr) {
Expand Down

0 comments on commit 121090f

Please sign in to comment.