react icon indicating copy to clipboard operation
react copied to clipboard

Move devtool warnings into standalone test

Open zpao opened this issue 10 years ago • 5 comments

I talked with @jimfb about this and this will hopefully lead to a clearer distinction of what is being tested when as we move towards that integrating that devtools api throughout.

zpao avatar Jan 16 '16 00:01 zpao

@zpao Hello, what do you think about the following approach?

Add a file named after its module for each __tests__ folder if there are some warning() tests. For example. The names sound weird but concatenated path should be easy to find without guessing:

  • /src/addons/transitions/__tests__/addonsTransitionsWarnings-test.js
  • /src/isomorphic/classic/element/__tests__/isomorphicClassicElementWarnings-test.js
  • /src/renderers/dom/server/__tests__/renderersDomServerWarnings-test.js

Group tests like

describe('ReactClientDOMRenderers', function(){ // module name
  // if there are a lot of tests from different files \ components 
  // or if we need different beforeEach() for these tests
  describe('ReactDOM', function() { //component name
    describe('renderToString', function () { //tests group if needed
      it('should...', function(){ // the test itself
        //...
      });
    });
  });

  describe('ReactMount', function() { //component name
    describe('rendering React components at document', function () { //tests group if needed
      it('should...', function(){
        //...
      });
    })
  })

  // if there is a single component
  describe('rendering React components at document', function () { //tests group
    it('should...', function(){
    //...
    });
  })
});

If it works out, I can separate all warning() tests this way.

mdolbin avatar Jan 22 '16 10:01 mdolbin

The goal isn't to pull out all warning tests, only the ones that are specifically provided by a "devtool" integration (which is an in-progress effort). I think we only have the 1 of them right now and you can see the diff which moved some tests in https://github.com/facebook/react/commit/30ef056731f10a094661b0d288c68fbe0c044161. We should move the tests that were moved in that commit into a new file - ReactDOMUnknownPropertyDevtool-test.js (testing explicitly that the devtool itself works).

zpao avatar Jan 22 '16 20:01 zpao

Oh, I see, confused ReactDOMDevtools with DevTools itself. I'll move 30ef056 out and check for some more of this kind. Can I use described approach for naming & grouping other tests if any?

mdolbin avatar Jan 22 '16 21:01 mdolbin

No, we'll handle moving other warnings as they are integrated into the same sort of tooling as the ones in that commit.

zpao avatar Jan 22 '16 21:01 zpao

Ok, here is one more: ReactDOMSVGDeprecatedAttributeDevtool in 251d6c3

mdolbin avatar Jan 22 '16 22:01 mdolbin