Skip to content

Commit

Permalink
tests: make inline-fs-test not reliant on cwd (#13420)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Nov 23, 2021
1 parent bb89154 commit 62a552f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions build/test/plugins/inline-fs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,19 @@ describe('inline-fs', () => {
});

it('warns and skips on unsupported encoding', async () => {
const content = `const myTextContent = fs.readFileSync('${tmpPath}', 'binary');`;
const content = `const myTextContent = fs.readFileSync(
'${tmpPath}',
'binary'
);`;
const result = await inlineFs(content, filepath);
expect(result).toEqual({
code: null,
warnings: [{
text: 'only utf8 readFileSync is supported',
location: {
file: filepath,
line: 1,
column: 105,
line: 3,
column: 10,
},
}],
});
Expand Down Expand Up @@ -447,16 +450,19 @@ describe('inline-fs', () => {
});

it('warns and skips on unsupported encoding', async () => {
const content = `const files = fs.readdirSync('${tmpDir}', 'binary');`;
const content = `const files = fs.readdirSync(
'${tmpDir}',
'binary'
);`;
const result = await inlineFs(content, filepath);
expect(result).toEqual({
code: null,
warnings: [{
text: 'only utf8 readdirSync is supported',
location: {
file: filepath,
line: 1,
column: 87,
line: 3,
column: 10,
},
}],
});
Expand Down

0 comments on commit 62a552f

Please sign in to comment.