mardi 28 août 2018

Typescript test data

I have the following project structure:

/src
    file1.ts
    file2.ts
/tests
    test1.ts
    /data
        somedata.txt

In my tsconfig.json file i have set "outDir": "./dist". Since Webstorm compiles the files automatically, this means that I end up having:

/dist
    /src
        file1.js
        file2.js
    /tests
        test1.js
/src
    file1.ts
    file2.ts
/tests
    test1.ts
    /data
        somedata.txt

The problem is with assets. test1.ts and hence test1.js need to refer to ./data/somedata.txt that, once compiled, is not available in /dist.

How to solve this problem?

Aucun commentaire:

Enregistrer un commentaire