Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tdd Update #516

Merged
merged 6 commits into from Jan 9, 2018
Merged

Tdd Update #516

merged 6 commits into from Jan 9, 2018

Conversation

kingdavidmartins
Copy link
Contributor

Description

Update tdd script to work with both directories. Active Snippets & Archived Snippets

What does your PR belong to?

  • Website
  • Snippets
  • General / Things regarding the repository (like CI Integration)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking improvement of a snippet)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Lodash Backlog

  • I added the prefix [UPDATE: method.md] or [ADD: method.md]
  • I have referenced the method to the lodash backlog.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have checked that the changes are working properly
  • I have checked that there isn't any PR doing the same
  • I have read the CONTRIBUTING document.

@Chalarangelo Chalarangelo mentioned this pull request Jan 9, 2018
scripts/tdd.js Outdated
// Grab snippetData
const fileData = fs.readFileSync(`${SNIPPETS_PATH}/${fileName}.md`, 'utf8');
const fileData = fs.readFileSync(`${activeOrArchive}/${fileName}.md`, 'utf8');
// Grab snippet Code blocks
const fileCode = fileData.slice(fileData.indexOf('```js'), fileData.lastIndexOf('```') + 3);

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@kingdavidmartins
Copy link
Contributor Author

kingdavidmartins commented Jan 9, 2018

Also @Chalarangelo I previously ignored the test/ dir But after some thought I honestly think not ignoring the test/ dir and retroactively collaboratively updating test though PR and having them in our repo will help have everyone have access to the most rigorous test suite. Don't think it would be fair to ignore the repo & locally have said test on my and/or anyone else machine especially in the case when someone has spent days/weeks updating/building test cases to handle all edges cases enabling their npm test to catch more of or all the bugs.

As other projects do ~ expose their test/ dir so community can also help develop

Example:
https://github.com/parcel-bundler/parcel

So I am going to run npm run tdd
and then commit all generated files and the update 1 test as an example.

@kingdavidmartins
Copy link
Contributor Author

As you can see by the latest commit

add test for average -> average(1, 9) equals 5 ~ 9a51505

Now the test/ has one extra test for the snippet average.md which everyone can now also use with their test suite when running npm test

@rohitanwar
Copy link
Contributor

I don't know much so don't get 😠 at my stupid question.

Will you like typing all of the tests or test only the examples ? Because I see something like test in average.test.js only and not in other files

@Chalarangelo
Copy link
Owner

@kingdavidmartins Yep, I wanted to ask you if there was a higher purpose to ignoring the test dir, I totally agree we should have it open to community, but be super careful with PRs changing test cases.

@kriadmin All snippets will get test cases added over time. We will probably have a guideline about that (like 20-25 test cases at most, except snippets that explicitly require more) and we will carefully add them to existing snippets over time.

I think the PR is ready to merge now and we are set to close the related issue (#78) and start adding tests over time, right?

@kingdavidmartins
Copy link
Contributor Author

@Chalarangelo Hahaha I guess I was mistaken. I actually thought you said you didn't want users exposed test/ in one of the discussions so ignored the test/ dir.

I totally agree we should have it open to community, but be super careful with PRs changing test cases.

Yup Yup. Pretty much #78 should is good to go & PR ready to get merged

Hey @kriadmin 👋 😄 we all still learning so don't ever feel whatever you ask is or will ever be considered a stupid question. You have contributed a lot to the project as is & are more than capable.

Pretty much what @Chalarangelo said. The only thing I will add is that every snippet example that is added to the snippet should be added to the test. So starting out all snippet test should have 2 tests out of the 20-25 added from the examples then the community can really build things out from there

@Chalarangelo
Copy link
Owner

@kingdavidmartins Ok, I'll go have lunch, retest your branch one last time, merge, close #78 and then maybe write a few tests myself and play around with the process a bit. I will also update tdd to run on the cron job properly.

@Chalarangelo
Copy link
Owner

Ah, it already does run on the cron jobs, I had forgotten about that. Everything seems fine, I am merging and resolving #78 finally.

@Chalarangelo Chalarangelo merged commit aea08ba into Chalarangelo:master Jan 9, 2018
@kingdavidmartins kingdavidmartins deleted the tdd-update branch January 15, 2018 13:11
@lock
Copy link

lock bot commented Dec 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for any follow-up tasks.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants