MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / run

Function run

lib/commands/test.js:166–240  ·  view source on GitHub ↗
(commandOptions)

Source from the content-addressed store, hash-verified

164 },
165
166 async run(commandOptions) {
167 if (this.isViteProject) {
168 if (commandOptions.outputPath) {
169 return Promise.reject(
170 new SilentError('The `--output-path` option to `ember test` is not supported in Vite-based projects.')
171 );
172 }
173
174 if (commandOptions.server) {
175 return Promise.reject(
176 new SilentError(
177 'The `--server` option to `ember test` is not supported in Vite-based projects. Please use the `start` script from package.json and visit `/tests` in the browser.'
178 )
179 );
180 }
181 }
182
183 let hasBuild = !!commandOptions.path;
184 let outputPath;
185
186 if (hasBuild) {
187 outputPath = path.resolve(commandOptions.path);
188
189 if (!fs.existsSync(outputPath)) {
190 throw new SilentError(
191 `The path ${commandOptions.path} does not exist. Please specify a valid build directory to test.`
192 );
193 }
194 } else {
195 outputPath = commandOptions.outputPath || this.tmp();
196 }
197
198 process.env['EMBER_CLI_TEST_OUTPUT'] = outputPath;
199
200 let testOptions = Object.assign(
201 {},
202 commandOptions,
203 {
204 ui: this.ui,
205 outputPath,
206 project: this.project,
207 port: await this._generateTestPortNumber(commandOptions, this.ui),
208 },
209 this._generateCustomConfigs(commandOptions)
210 );
211
212 await Win.checkIfSymlinksNeedToBeEnabled(this.ui);
213 let session;
214 if (commandOptions.server) {
215 if (hasBuild) {
216 session = this.runTask('TestServer', testOptions);
217 } else {
218 let builder = new this.Builder(testOptions);
219 testOptions.watcher = (
220 await this.Watcher.build(
221 Object.assign(this._env(), {
222 builder,
223 verbose: false,

Callers

nothing calls this directly

Calls 3

cleanupMethod · 0.95
buildMethod · 0.45

Tested by

no test coverage detected