Comments (6)
Hi @superkew and thank you for opening an issue. Actually you can't import files in es6 modules syntax using wildcards. If you want to achieve this result you should build a bundle task to run before "npm run test" that bundle all spec files.
Ionic team is working on an a specific task in ionic app script for unit tests and e2e test based on angular cli.
from ionic-boilerplate.
It's a pity we can't use the normal karma imports for wildcards, but good to hear that ionic will be creating some tooling for us :)
from ionic-boilerplate.
@superkew have a look at following gist to achieve such glob support and still use rollup.
There is one problem with such solution tough - you'll have to somehow init test environment (as in current shim). Doing so in every test will throw an error as you can only do so once per test session. I ended up creating singleton for test environment initialization which based on static flag executes following:
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
from ionic-boilerplate.
just run:
npm run test:watch
And now all your spec file are watched and loaded in karma-shim automatically.
from ionic-boilerplate.
Thank you!
from ionic-boilerplate.
Hey @marcoturi and @superkew . I submitted another approach to do this. The karma-shim.ts
is not changed with the watch. I created a file that generate a index.ts
with import
statements. So, the karma-shim.ts
contains only a simple import "../src"
.
With this, run npm test
and the index.ts
file will be created on pretest
package.json script.
Please, see my PR !1 and check which the better approach to a standard structure :)
from ionic-boilerplate.
Related Issues (20)
- Unit tests broken HOT 1
- Source map/debugging not working in unit tests HOT 1
- yarn failed on gitlab HOT 4
- Does tests get in the production build? HOT 1
- No gulp? HOT 3
- When running karma test, at-loader broke HOT 4
- scss-lint fails HOT 4
- Angular Language Services HOT 5
- npm run android:dev failed HOT 1
- Cannot run in production mode HOT 1
- add a pre-build step HOT 4
- Themed application HOT 1
- Themes HOT 1
- Is it possible to start a project with ionic 2 and not 3? HOT 2
- Issue on npm run ios:dev HOT 1
- Quickstart guide needs to be updated? HOT 2
- npm run e2e E/protractor - Could not find Angular on page
- Can't run on Android with npm run android:dev
- Style guide
- if I run npm run ios:dev nothing happen HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ionic-boilerplate.