Skip to content

Commit

Permalink
test(new config module): write the new config format for the differen…
Browse files Browse the repository at this point in the history
…t test templates
  • Loading branch information
BlueCutOfficial committed May 30, 2024
1 parent 9be1814 commit dbe4523
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 19 deletions.
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 4 additions & 19 deletions tests/addon-template/tests/dummy/app/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
// from https://github.com/ember-cli/ember-cli/blob/master/lib/broccoli/app-config-from-meta.js
export default (function() {
let config = function() {
let prefix = 'dummy';
let metaName = prefix + '/config/environment';
try {
let rawConfig = document.querySelector('meta[name="' + metaName + '"]').getAttribute('content');
let config = JSON.parse(decodeURIComponent(rawConfig));
let exports = { 'default': config };
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}
catch(err) {
throw new Error('Could not read config from meta tag with name "' + metaName + '".');
}
}()
config.default.APP.fromConfigModule = 'hello new world';
return config;
})().default;
import loadConfigFromMeta from '@embroider/config-meta-loader';

export default loadConfigFromMeta('dummy');
// config.APP.fromConfigModule = 'hello new world';
3 changes: 3 additions & 0 deletions tests/app-template/app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import loadConfigFromMeta from "@embroider/config-meta-loader";

export default loadConfigFromMeta('app-template');
1 change: 1 addition & 0 deletions tests/app-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.0.3",
"@embroider/compat": "workspace:*",
"@embroider/config-meta-loader": "workspace:*",
"@embroider/core": "workspace:*",
"@embroider/router": "workspace:*",
"@embroider/test-setup": "workspace:*",
Expand Down
3 changes: 3 additions & 0 deletions tests/ts-app-template-classic/app/config/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import loadConfigFromMeta from '@embroider/config-meta-loader';

export default loadConfigFromMeta('ts-app-template');
1 change: 1 addition & 0 deletions tests/ts-app-template-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.2.0",
"@embroider/compat": "workspace:*",
"@embroider/config-meta-loader": "workspace:*",
"@embroider/core": "workspace:*",
"@embroider/router": "workspace:*",
"@embroider/test-setup": "workspace:*",
Expand Down
3 changes: 3 additions & 0 deletions tests/ts-app-template/app/config/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import loadConfigFromMeta from '@embroider/config-meta-loader';

export default loadConfigFromMeta('ts-app-template');
1 change: 1 addition & 0 deletions tests/ts-app-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.2.0",
"@embroider/compat": "workspace:*",
"@embroider/config-meta-loader": "workspace:*",
"@embroider/core": "workspace:*",
"@embroider/router": "workspace:*",
"@embroider/test-setup": "workspace:*",
Expand Down

0 comments on commit dbe4523

Please sign in to comment.