Comments (2)
@matthewcornell I generally recommend against use of non-standard JavaScript.
However, QUnit does not mind if you use alternative JavaScript compilation targets such as CoffeeScript, TypeScript, Webpack-customised imports, or Babel (for new Ecma syntax in current browsers). In that case, you will have to build your source code first and import the output of your build process in your test suite, rather than your underlying source files. This is similar to what your application would do, and makes the test more representative of what your application will be experiencing as well.
There are a number of different ways to do this. When testing your code within Node.js, you can use the --require
option of the QUnit CLI to register an automatic pre-processing step that will automatically handle Babel and TypeScript. I don't recall if Webpack supports something like this, if it does, you could use that.
Otherwise, you may have to add an explicit step before your test command. For example, in package.json, you might write
"test": "esbuild && qunit"
Or,
"build": "webpack …",
"test": "npm run build && qunit",
"test-watch": "qunit -w",
Naturally, you can combine the watch modes as well. For example, you might have npm run build-watch
open in one terminal tab, and npm run test-watch
open in another.
from qunit.
Following up, I believe I got this working by extracting import './mystyles.css';
to a separate .js file and then adding that file to the webpack.config.cjs's entry
section. Note that the order in that section was significant. I would still welcome your comments, thanks.
from qunit.
Related Issues (20)
- qunit: command not found HOT 2
- Great convergence effort/suggestion: Making QUnit proxy to node.js and deno testing APIs in these environments HOT 2
- Add DOM hook to allow links to be added after the Rerun link HOT 1
- Allow raw HTML as an assertion message HOT 1
- Improve assert.async Function to Handle Type Checking
- Qunit v2 has incorrectly configured exports HOT 4
- Drop support for IE9-IE10 HOT 3
- Can we move this repo to a monorepo so we can more accurately test different usage scenarios? HOT 1
- Drop support for node < 18? HOT 1
- Can we drop builtin AMD support? HOT 6
- Can we start a `next` branch so I can start PRing improvements? HOT 1
- Let simple array data in test.each() serve as automatic labels
- Facilitate "close to" number equal assertion HOT 3
- [Feature Request]: Allow more customization of how errors are handled (especially uncaughtrejection). HOT 1
- Web Test Runner and QUnit reporting problems HOT 9
- qunit cannot parse private functions and properties HOT 2
- Support multiple `module` parameters (QUnit.config.module array) HOT 2
- Unify qunitjs.com and api.qunitjs.com
- [QUESTION] How can I forcefully abort a testcase and advance to next in queue 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 qunit.