Comments (4)
Yeah, I think what you're aiming and what I'm decribing are essentially having some sort of low level shared "smoke tesys" we can easily run across multiple describe
/ files. Like something in addition to TestSetup
that could be pulled into each test. (it could also maybe include the repeated before
/ after
we use too)?
I think as long as each test case clearly own its own specific assertions and the setup / configuration is still in the hands of each test, and we keep this utility fairly low level and a convenience for just easily sanity testing a suite of tests before moving onto case specific it
, then that seems like a good balance to work towards. 👍
ex.
const TestSetup = require('./setup');
const TestUtils = require('./utils');
describe('building greenwood with custom userWorkspace directory', () => {
before(async () => {
// custom userland config
const config = {
userWorkspace: 'www'
};
// get a custom configured context
CONTEXT = await setup.init(config);
// setup a testing environment
setup = new TestSetup(CONTEXT);
setup.setupWorkspace(); // fs.mkdirSync, etc
// run the tool
await setup.run(['./packages/cli/index.js', 'build']);
});
it('should pass all smoke tests', async () => {
TestUtils.runSmokeTest(CONTEXT);
});
it('should test some other things...', async () => {
// maybe it would be good to update our CONTRIBUTING.md to add best practices, tips for writing unit tests for the project?
});
after(async() => {
setup.teardownWorkspace(); // fs.remove, etc
});
});
IDK. My main concern is really limiting what happens in this line
TestUtils.runSmokeTest(CONTEXT);
The value of testing is recreating the users experience using our tool, too much abstraction could keep us too far removed from that and miss bugs / make assumptions not specific to how a user would actually be doing it.
from greenwood.
I agree, but the way I see it there are 2 types of tests that have to be done:
- tests on the default template
- tests on the user workspace
each of these cases, may need to test 1 or both those types of tests.
the user workspace test should include nested directories. So for example, if we're testing a config, I want to test all userworkspace related things, including nested directories.
I'm definitely in favor of splitting it up but there's a number of shared tests.
from greenwood.
Pretty good watch on general testing strategies
https://www.youtube.com/watch?v=cB5WZgMwdpE
from greenwood.
PRs to watch for coverage here
- #66
- try and get testing of HTML output lost in #58
from greenwood.
Related Issues (20)
- single file bundles (SFBs) for SSR page and API routes HOT 1
- markdown rendering not correctly processing the text `$1`
- minimal `Response` throws errors in development and production lifecycles
- implement a more idiomatic (HTML) templating solution
- upgrade plugin-typescript to TypeScript `5.x`
- adapter SSR pages are rendering with incorrect content type header
- Edge Runtime support for Adapter plugins HOT 1
- AWS Adapter plugin HOT 1
- Cloudflare Adapter plugin
- support additional `Request.body` formats
- custom imports bundling breaks when used in API routes and SSR pages
- templates with (inline) template strings breaks bundling of SSR pages
- devServer proxy not returning content (when proxied response includes a `content-encoding` header)
- custom loader hook not handling bare specifiers when resolve URLs (`invalid URL`)
- Isomorphic Asset Bundling
- Content as Data (Content Graph)
- Support "active links" in terminal output for server URLs
- configuration option for trailing forward slash
- custom response and constructor props for SSR pages
- support all CSS function pseudo classes / elements for CSS optimizing
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 greenwood.