Skip to content

Commit 842ac8f

Browse files
committed
Get fixtures copied correctly
1 parent 37d3106 commit 842ac8f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

webpack.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@ async function getExtensionConfig(target, mode, env) {
175175
// Add fixtures copying plugin for node target (which has individual test files)
176176
if (target === 'node') {
177177
const fs = require('fs');
178-
178+
const srcRoot = 'src';
179179
class CopyFixturesPlugin {
180180
apply(compiler) {
181181
compiler.hooks.afterEmit.tap('CopyFixturesPlugin', () => {
182-
this.copyFixtures('src', compiler.options.output.path);
182+
this.copyFixtures(srcRoot, compiler.options.output.path);
183183
});
184184
}
185-
185+
186186
copyFixtures(inputDir, outputDir) {
187187
try {
188188
const files = fs.readdirSync(inputDir);
@@ -191,7 +191,7 @@ async function getExtensionConfig(target, mode, env) {
191191
const stats = fs.statSync(filePath);
192192
if (stats.isDirectory()) {
193193
if (file === 'fixtures') {
194-
const outputFilePath = path.join(outputDir, inputDir, file);
194+
const outputFilePath = path.join(outputDir, inputDir.substring(srcRoot.length), file);
195195
const inputFilePath = path.join(inputDir, file);
196196
fs.cpSync(inputFilePath, outputFilePath, { recursive: true, force: true });
197197
} else {
@@ -205,7 +205,7 @@ async function getExtensionConfig(target, mode, env) {
205205
}
206206
}
207207
}
208-
208+
209209
plugins.push(new CopyFixturesPlugin());
210210
}
211211

@@ -232,7 +232,7 @@ async function getExtensionConfig(target, mode, env) {
232232
} else if (target === 'node') {
233233
// Add main test runner
234234
entry['test/index'] = './src/test/index.ts';
235-
235+
236236
// Add individual test files as separate entry points
237237
const testFiles = glob.sync('src/test/**/*.test.ts', { cwd: __dirname });
238238
testFiles.forEach(testFile => {

0 commit comments

Comments
 (0)