aurelia / testing

Simplifies the testing of UI components by providing an elegant, fluent interface for arranging test setups along with a number of runtime debug/test helpers.
MIT License
40 stars 27 forks source link

How to change base folder for StageComponent.withResources()? #64

Closed nashwaan closed 6 years ago

nashwaan commented 7 years ago

This aurelia/testing repo uses JSPM for compilling and running tests and everything works great. But I am struggling with one thing here: How can I change the base folder for all my StageComponent.withResources() to be based on './src', for example, so that I can write this:

component = StageComponent.withResources('my-component')

Instead of:

component = StageComponent.withResources('src/my-component')

On the other hand, using the navigation skeleton aurelia/skeleton repo which is based on karma / jest for compiling and running tests, I want to change the base folder for all my StageComponent.withResources() so that I can write this:

component = StageComponent.withResources('src/my-component')

Instead of:

component = StageComponent.withResources('my-component')
Alexander-Taran commented 6 years ago

For Jest, CLI generates jest-pretest.ts with contents like this

import 'aurelia-polyfills';
import {Options} from 'aurelia-loader-nodejs';
import {globalize} from 'aurelia-pal-nodejs';
import * as path from 'path';
Options.relativeToDir = path.join(__dirname, 'src');
globalize();

and it is referenced in Jest configuration in package.json. Options.relativeToDir - is what you are looking for

Alexander-Taran commented 6 years ago
async triageQuestion(id) =>{
 respondAYearLater()
 let response = await getResponseFromOP( { timeout : 4weeks } )
 if(!response) {
    closeQuestion(id,randomReason())
 }
}