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

running tests with karma #421

Merged
merged 14 commits into from
Sep 14, 2016
Merged

running tests with karma #421

merged 14 commits into from
Sep 14, 2016

Conversation

nfcampos
Copy link
Collaborator

@nfcampos nfcampos commented May 27, 2016

where this is at:

  • all tests are running
  • 2 are failing fixed now (were failing because the tests were assuming the body was empty)
  • only running in chrome for now chrome and firefox

todo

  • add source maps
  • see why 2 tests are failing
  • run in firefox
  • set up for travis
  • run with react 0.13
  • run with react 0.14
  • run with react 15

@aweary
Copy link
Collaborator

aweary commented May 27, 2016

Awesome start @nfcampos this is going to be great. Should let us support + test SVGs for #375

@nfcampos nfcampos force-pushed the karma branch 3 times, most recently from 3e0b7f3 to c42d0a0 Compare June 2, 2016 18:41
@nfcampos
Copy link
Collaborator Author

nfcampos commented Jun 4, 2016

this is ready to merge now I believe 😀

before_script:
- "sh install-relevant-react.sh"
- if [ $KARMA == 1 ]; then export CHROME_BIN=chromium-browser; fi
- if [ $KARMA == 1 ]; then export DISPLAY=:99.0; fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can all three of these commands be combined into one line, if they're related?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I've combined them

@nfcampos nfcampos force-pushed the karma branch 2 times, most recently from 3ec1838 to cc386f6 Compare June 6, 2016 16:53
@nfcampos
Copy link
Collaborator Author

nfcampos commented Jun 6, 2016

3 tests fail when ran on Firefox 45.0 and react 15.1.0 with karma because of this firefox bug facebook/react#6896 it'll be fixed in a future version of react (or firefox) so I don't think there's anything for us to do here other than be aware of it.
screen shot 2016-06-06 at 18 12 19

@nfcampos
Copy link
Collaborator Author

oops, accidentally closed this, will reopen tomorrow

@aweary
Copy link
Collaborator

aweary commented Jul 5, 2016

@nfcampos what's the status on this?

@nfcampos
Copy link
Collaborator Author

nfcampos commented Jul 5, 2016

I'll rebase and after that it should be ready to go

@nfcampos nfcampos force-pushed the karma branch 3 times, most recently from 7747c83 to d9fbe3e Compare July 8, 2016 17:25
@nfcampos
Copy link
Collaborator Author

nfcampos commented Jul 8, 2016

@aweary do you want to take a look at this before it gets out of date again? :)

@nfcampos nfcampos force-pushed the karma branch 2 times, most recently from 27d488e to 4672e04 Compare July 18, 2016 20:45
@nfcampos nfcampos force-pushed the karma branch 2 times, most recently from 5d06c6a to dee5cba Compare August 27, 2016 16:54
@nfcampos
Copy link
Collaborator Author

I've rebased this on the current master, does someone want to review this?


var VERSION = React.version;

module.exports = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this file changing from ES6 exports to node exports?

Copy link
Collaborator Author

@nfcampos nfcampos Aug 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because I need to import it in the karma conf file and I don't want to transpile that
makes sense?

the other option is to require('babel-register') at the beginning of the karma conf file. would that be better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer npm run build before the karma tests, so that the tests are always running on the build output.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm ok, makes sense. so i guess the test:karma command in package.json should run build before? or we should do that manually when testing with karma?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, actually that's pretty inconvenient, because the test files themselves import the source files from src, not from build, what do you suggest for that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, that's a good point. since the mocha tests use babel-register, let's just use that here too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

],

preprocessors: {
'test/*.jsx': ['webpack', 'sourcemap'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.js might need preprocessing too - we use babel for every file, and .jsx is only for files that contain JSX

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this

@nfcampos
Copy link
Collaborator Author

does anyone else want to review this?

@nfcampos
Copy link
Collaborator Author

@aweary @ljharb do we want to merge this before it gets out of date again ;) ?

@ljharb
Copy link
Member

ljharb commented Sep 14, 2016

LGTM

@ljharb ljharb merged commit 84c16e4 into master Sep 14, 2016
@ljharb ljharb deleted the karma branch September 14, 2016 18:56
@ljharb ljharb added the Tests label Sep 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants