Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function (defaults) {
enableTypeScriptTransform: true,
},
'ember-cli-memory-leak-detector': {
enabled: process.env.DETECT_MEMORY_LEAKS || false,
enabled: true, // process.env.DETECT_MEMORY_LEAKS || false,
},
});

Expand Down
9 changes: 6 additions & 3 deletions test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"test": "tests"
},
"scripts": {
"postinstall": "patch-package",
"build": "ember build --environment=production",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:' --prefix-colors cyan,white,yellow",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:' --prefix-colors cyan,white,yellow",
Expand All @@ -29,7 +30,7 @@
"ember-auto-import": "^2.4.2",
"ember-cached-decorator-polyfill": "^1.0.1",
"ember-functions-as-helper-polyfill": "^2.1.1",
"ember-headless-table": "workspace:../ember-headless-table",
"ember-headless-table": "file:../ember-headless-table",
"ember-resources": "^5.4.0",
"tracked-built-ins": "^3.1.0"
},
Expand Down Expand Up @@ -83,13 +84,14 @@
"ember-cli-dependency-checker": "^3.3.1",
"ember-cli-htmlbars": "^6.1.0",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-memory-leak-detector": "^0.7.1",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-fetch": "^8.1.1",
"ember-load-initializers": "^2.1.2",
"ember-page-title": "^8.0.0-beta.0",
"ember-qunit": "^6.0.0",
"ember-qunit": "^5.0.0",
"ember-resolver": "^8.0.3",
"ember-source": "~3.28.0",
"ember-source-channel-url": "^3.0.0",
Expand All @@ -104,8 +106,9 @@
"eslint-plugin-qunit": "^7.3.1",
"expect-type": "^0.14.2",
"loader.js": "^4.7.0",
"patch-package": "^6.5.1",
"prettier": "^2.7.1",
"qunit": "^2.19.1",
"qunit": "~2.16.0",
"qunit-dom": "^2.0.0",
"typescript": "^4.8.3",
"webpack": "^5.74.0"
Expand Down
33 changes: 33 additions & 0 deletions test-app/patches/ember-cli-memory-leak-detector+0.7.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/node_modules/ember-cli-memory-leak-detector/lib/inventory-classes.js b/node_modules/ember-cli-memory-leak-detector/lib/inventory-classes.js
index 278f82e..bbb41f1 100644
--- a/node_modules/ember-cli-memory-leak-detector/lib/inventory-classes.js
+++ b/node_modules/ember-cli-memory-leak-detector/lib/inventory-classes.js
@@ -1,5 +1,6 @@
const glob = require("glob");
const fs = require("fs");
+const path = require("path");

const { parse } = require("@babel/parser");
const { visit } = require("ast-types");
@@ -15,7 +16,20 @@ module.exports = function inventoryClasses(addon) {
})
.reduce((acc, val) => acc.concat(val), []); // flatten

- return classNames;
+ /**
+ * We could probably scan all direct dependencies of the project-under-test, and evaluate their "exports"
+ * or fallback to the "old ember lookup logic" for v1 addons. (addon folder, etc)
+ */
+ const customFiles = glob.sync(`${path.join(__dirname, '../../../../ember-headless-table/dist')}/**/*.{js,ts}`);
+ const customClassNames = jsFiles
+ .map((file) => {
+ const content = fs.readFileSync(file, { encoding: "utf-8" });
+ return getClassNamesFromFile(content);
+ })
+ .reduce((acc, val) => acc.concat(val), []); // flatten
+
+
+ return classNames.concat(customClassNames);
};

function getPathForJsFiles(addon) {
3 changes: 2 additions & 1 deletion test-app/testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ module.exports = {
browser_start_timeout: 120,
browser_args: {
Chrome: {
dev: ['--remote-debugging-port=9222'],
ci: [
// --no-sandbox is needed when running Chrome inside a container
process.env.CI ? '--no-sandbox' : null,
'--headless',
'--disable-dev-shm-usage',
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--remote-debugging-port=9222',
'--window-size=1440,900',
].filter(Boolean),
},
Expand Down
Loading