Skip to content

Commit

Permalink
fix: fix nightly compare-before-emit-disable test failed
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrykingxyz committed Dec 17, 2024
1 parent fb2869d commit d4d86b2
Showing 1 changed file with 33 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,37 @@ let first_asset_mtime;

/** @type {import('../../dist').TCompilerCaseConfig} */
module.exports = {
description: "should write same content to same file",
options(context) {
return {
output: {
path: context.getDist(),
filename: "main.js",
compareBeforeEmit: false
},
context: context.getSource(),
entry: "./d",
};
},
async build(context, compiler) {
rimrafSync(context.getDist());
await new Promise(resolve => {
compiler.run(() => {
first_asset_mtime = fs.statSync(path.join(context.getDist("main.js")))?.mtime;
compiler.run(() => {
resolve();
});
});
});
},
async check(context) {
let second_asset_mtime = fs.statSync(path.join(context.getDist("main.js")))?.mtime;
expect(first_asset_mtime).not.toEqual(second_asset_mtime);
}
description: "should write same content to same file",
options(context) {
return {
output: {
path: context.getDist(),
filename: "main.js",
compareBeforeEmit: false
},
context: context.getSource(),
entry: "./d"
};
},
async build(context, compiler) {
rimrafSync(context.getDist());
await new Promise(resolve => {
compiler.run(() => {
first_asset_mtime = fs.statSync(
path.join(context.getDist("main.js"))
)?.mtime;
setTimeout(() => {
compiler.run(() => {
resolve();
});
}, 100);
});
});
},
async check(context) {
let second_asset_mtime = fs.statSync(
path.join(context.getDist("main.js"))
)?.mtime;
expect(first_asset_mtime).not.toEqual(second_asset_mtime);
}
};

0 comments on commit d4d86b2

Please sign in to comment.