-
Notifications
You must be signed in to change notification settings - Fork 44
/
index.js
33 lines (28 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
/* eslint-disable node/no-extraneous-require */
const WriteFile = require('broccoli-file-creator');
const MergeTrees = require('broccoli-merge-trees');
const BroccoliDebug = require('broccoli-debug');
const debugTree = BroccoliDebug.buildDebugCallback('@percy/ember');
const pkg = require('./package');
module.exports = {
name: pkg.name,
included() {
this._super.included.apply(this, arguments);
this.import('node_modules/@percy/sdk-utils/dist/bundle.js', {
using: [{ transformation: 'amd' }],
type: 'test'
});
},
treeForAddonTestSupport(tree) {
let meta = new WriteFile('@percy/ember/env.js', (
`export default ${JSON.stringify({
VERSION: pkg.version,
PERCY_SERVER_ADDRESS: process.env.PERCY_SERVER_ADDRESS
})};\n`
));
let input = debugTree(new MergeTrees([tree, meta]), 'addon-test-support:input');
let output = this.preprocessJs(input, '/', this.name, { registry: this.registry });
return debugTree(output, 'addon-test-support:output');
}
};