Skip to content

Commit 1819638

Browse files
committed
test(css): fix lint and address Copilot feedback
- Type the `conventions` array as `ExportsConventionLiteral[]` so TypeScript narrows to the `exportsConvention` enum (fixes the lint job failure on PR #20884). - Convert the second `it()` to use `.then(...).catch(done)` instead of `.then(onFulfilled, done)` — the two-callback form does not forward assertion failures thrown inside the fulfillment callback, so failures could surface as unhandled rejections / timeouts (Copilot review feedback). https://claude.ai/code/session_01Dp4wfcAdJPVdZaBpvD1QNZ
1 parent 8b2a42c commit 1819638

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

test/configCases/css/named-exports-mangling/index.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,19 @@ it(`should expose the right export shape per convention (${matrixTitle})`, (done
7272
});
7373

7474
it(`should expose default export when namedExports is disabled (${matrixTitle})`, (done) => {
75-
import("./style.module.css?camel-case").then((mod) => {
76-
if (namedExports) {
77-
// Named exports: the camelCase identifier sits on the namespace
78-
expect(mod.btnInfoIsDisabled).toBeDefined();
79-
} else {
80-
// Default-only mode: exports are nested under `default`
81-
expect(mod.default).toBeDefined();
82-
expect(mod.default.btnInfoIsDisabled).toBeDefined();
83-
}
84-
done();
85-
}, done);
75+
import("./style.module.css?camel-case")
76+
.then((mod) => {
77+
if (namedExports) {
78+
// Named exports: the camelCase identifier sits on the namespace
79+
expect(mod.btnInfoIsDisabled).toBeDefined();
80+
} else {
81+
// Default-only mode: exports are nested under `default`
82+
expect(mod.default).toBeDefined();
83+
expect(mod.default.btnInfoIsDisabled).toBeDefined();
84+
}
85+
done();
86+
})
87+
.catch(done);
8688
});
8789

8890
it(`should mark JS named exports as mangleable in production for every convention (${matrixTitle})`, () => {

test/configCases/css/named-exports-mangling/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ const webpack = require("../../../../");
55
/** @typedef {import("../../../../").Configuration} Configuration */
66
/** @typedef {import("../../../../").ParserOptionsByModuleTypeKnown} ParserOptionsByModuleTypeKnown */
77
/** @typedef {import("../../../../").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */
8+
/** @typedef {NonNullable<GeneratorOptionsByModuleTypeKnown["css/module"]>["exportsConvention"]} ExportsConvention */
9+
/** @typedef {Extract<ExportsConvention, string>} ExportsConventionLiteral */
810

11+
/** @type {ExportsConventionLiteral[]} */
912
const conventions = [
1013
"as-is",
1114
"camel-case",

0 commit comments

Comments
 (0)