Move some testing helpers into a module
See original GitHub issueMight be a little less setup? Something like (maybe need to split up or move arguments around): Basically always unpad, trim
const babel = require("babel-core");
const unpad = require("utils/unpad");
export function transform(source, plugin, options) {
return babel.transform(unpad(source), {
plugins: [[plugin, options]],
}).code.trim();
}
export function expectTransform(source, expected, plugin, options = {}) {
return expect(transform(source, plugin, options)).toBe(unpad(expected));
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Rails: Moving a helper method form a test to test_helper.rb
Turns out that I had to wrap the helper method into a module: # test_helper.rb class ActionController::TestCase module CheatWithAuth do def ...
Read more >Move useful helper methods for working with entities ... - Drupal
Move useful helper methods for working with entities to the KernelTestBase class. Other possibilities were: a. Remove the 'entity_test' module ...
Read more >Modules And Helpers - Codeception Docs
All actions and assertions that can be performed by the Tester object in a class are defined in modules. You can extend the...
Read more >Test helpers | Spryker Documentation
These helpers allow you to hook into the lifecycle of tests and get handy methods available wherever the helper is enabled. Codeception and ......
Read more >No way to use helpers/modules inside dataprovider methods
I have some helpers to create common Stubs. These work fine in the test methods. However, as above, these cannot be used in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Jest snapshots work with any serializable value, we just haven’t documented it yet. This is actually the ideal use case for snapshots and should allow you guys to move much faster. Also cc @kyldvs who loves using it for strings.
Added in #606 . 😃