Comments (6)
Yup, will be fixed in the next version
from core.
@thetutlage Actually I created a fork for it, I'm going to make a PR for it.
https://github.com/un-versed/japa
I'm exposing a sort
function, that can be used at configure method in japaFile.ts
The code:
japaFile.ts
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
/**
* Configure test runner
*/
configure({
files: ['test/**/*.spec.ts'],
before: [
runMigrations,
runSeeds,
startHttpServer,
],
after: [rollbackMigrations],
sort: collator.compare
})
I'm using a collator, but you can use any sorting function tho
The previous code still works because:
src/SlimRunner/Loader.ts
/**
* If _sortFn is defined, then filter the files
*/
if (typeof (this._sortFn) === 'function') {
filesPaths = filesPaths.sort(this._sortFn)
} else {
filesPaths.sort()
}
I'm changing my repo to match the CONTRIBUTING.md rn
from core.
Great :) Actually, I am changing the japa a lot. Diving it into a separate runner and separate core. So PR for the old codebase won't help
from core.
Oh, I got it ππ» anxious for the new version
But, there's a chance do add this in the old codebase? Actually I'm using my own package distribution from Japa in npm, just to have this feature in my project.
If there's no chance, I won't write tests for it right now...
from core.
Sure. Feel free to send a PR for the develop
branch
from core.
The newer version allows defining a custom function for the files
property. You can achieve what you need as follows.
import fastGlob from 'fast-glob'
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
files: async () => {
const files = await fastGlob('tests/**/*.spec.js')
return files.sort(collator)
}
Lemme know if you face any issues. We can reopen the issue
from core.
Related Issues (20)
- Question: How to run tests as an authenticated user HOT 2
- nodemon conflicts HOT 3
- Can group initialization be asynchronous? HOT 5
- Running multiple files does not work HOT 1
- Add Suite layer to Refiner HOT 2
- Change Private methods and properties to Protected to use Japa classes as Base classes HOT 2
- Broken documentation link HOT 1
- Cannot Access Assert from JapaFile.ts HOT 1
- Skip test by default when calling ".skip()" without parameter HOT 2
- Add the ability to use Dataset property in the title HOT 2
- Asynchronous datasets / datasets not supported anymore? Multiple chained asynchronous test dependencies HOT 7
- Can't start adonis server when migrated to @japa/runner HOT 1
- Can't start tests on windows HOT 1
- OpenAPI HTTP Testing in Adonis with Japa HOT 1
- Match all tags in filter HOT 10
- Where to post some questions ? HOT 2
- Error in group functions is swallowed and not shown HOT 4
- Filter by group title also executes "root" tests HOT 5
- How get dynamic title for each test with array strings in dataset? 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 core.