Skip to content

Commit 19b6957

Browse files
committed
test(treeshake-check): move fixture JS out of dist/ and fix CI failures
Fixture JS files are hand-authored test data, not build output. Moving them from dist/index.js to index.js avoids conflicts with the root **/dist gitignore rule, which was silently excluding them from git. In CI the files were missing, causing rollup to treat them as external and return FullyTreeshakeable for enum-only and mixed, failing the HasSideEffects assertions. Also migrates integration tests from `live` to `layer + it.scoped` to align with the rest of the test suite.
1 parent b6f4545 commit 19b6957

10 files changed

Lines changed: 11 additions & 12 deletions

File tree

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ e2e/*/dist
1313
*/dist
1414
**/dist/*
1515
**/**/*.d.ts*
16+
tools/treeshake-check/src/__fixtures__/**

packages/davinci-client/api-report/davinci-client.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function davinci<ActionType extends ActionTypes = ActionTypes>(input: {
270270
start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(options?: StartOptions<QueryParams> | undefined) => Promise<ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode>;
271271
update: <T extends SingleValueCollectors | MultiSelectCollector | ObjectValueCollectors | AutoCollectors>(collector: T) => Updater<T>;
272272
validate: (collector: SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors) => Validator;
273-
poll: (collector: PollingCollector) => Poller;
273+
pollStatus: (collector: PollingCollector) => Poller;
274274
getClient: () => {
275275
action: string;
276276
collectors: Collectors[];

packages/davinci-client/api-report/davinci-client.types.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function davinci<ActionType extends ActionTypes = ActionTypes>(input: {
270270
start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(options?: StartOptions<QueryParams> | undefined) => Promise<ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode>;
271271
update: <T extends SingleValueCollectors | MultiSelectCollector | ObjectValueCollectors | AutoCollectors>(collector: T) => Updater<T>;
272272
validate: (collector: SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors) => Validator;
273-
poll: (collector: PollingCollector) => Poller;
273+
pollStatus: (collector: PollingCollector) => Poller;
274274
getClient: () => {
275275
action: string;
276276
collectors: Collectors[];

tools/treeshake-check/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ export default [
2020
},
2121
},
2222
{
23-
ignores: ['**/out-tsc', '**/__fixtures__/**/dist'],
23+
ignores: ['**/out-tsc'],
2424
},
2525
];

tools/treeshake-check/src/__fixtures__/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

tools/treeshake-check/src/__fixtures__/bad-syntax/dist/index.js renamed to tools/treeshake-check/src/__fixtures__/bad-syntax/index.js

File renamed without changes.

tools/treeshake-check/src/__fixtures__/clean/dist/index.js renamed to tools/treeshake-check/src/__fixtures__/clean/index.js

File renamed without changes.

tools/treeshake-check/src/__fixtures__/enum-only/dist/index.js renamed to tools/treeshake-check/src/__fixtures__/enum-only/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// TypeScript enum compiled output — classic IIFE pattern that prevents tree-shaking
22
var Status;
33
(function (Status) {
4-
Status["Active"] = "Active";
5-
Status["Inactive"] = "Inactive";
6-
Status["Pending"] = "Pending";
4+
Status['Active'] = 'Active';
5+
Status['Inactive'] = 'Inactive';
6+
Status['Pending'] = 'Pending';
77
})(Status || (Status = {}));
88

99
export { Status };

tools/treeshake-check/src/__fixtures__/mixed/dist/index.js renamed to tools/treeshake-check/src/__fixtures__/mixed/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// Enum IIFE
44
var Color;
55
(function (Color) {
6-
Color["Red"] = "Red";
7-
Color["Blue"] = "Blue";
6+
Color['Red'] = 'Red';
7+
Color['Blue'] = 'Blue';
88
})(Color || (Color = {}));
99

1010
// Prototype mutation
11-
String.prototype.toColor = function() {
11+
String.prototype.toColor = function () {
1212
return Color[this];
1313
};
1414

tools/treeshake-check/src/treeshake-check.integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { analyzeTreeshakeability, BundleFailed } from './lib/treeshake-check.js'
99

1010
const __dirname = fileURLToPath(new URL('.', import.meta.url));
1111

12-
const fixturePath = (name: string) => resolve(__dirname, '__fixtures__', name, 'dist', 'index.js');
12+
const fixturePath = (name: string) => resolve(__dirname, '__fixtures__', name, 'index.js');
1313

1414
layer(NodeContext.layer)('analyzeTreeshakeability integration', (it) => {
1515
it.scoped('reports clean package as fully tree-shakeable', () =>

0 commit comments

Comments
 (0)