OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 24 matching lines...) Expand all Loading... |
35 var beforeEach; | 35 var beforeEach; |
36 var afterEach; | 36 var afterEach; |
37 var RunAllTests; | 37 var RunAllTests; |
38 | 38 |
39 var assert = require('assert'); | 39 var assert = require('assert'); |
40 | 40 |
41 (function() { | 41 (function() { |
42 var TIMEOUT = 1000; | 42 var TIMEOUT = 1000; |
43 | 43 |
44 function PostMicrotask(fn) { | 44 function PostMicrotask(fn) { |
45 var o = {}; | 45 Promise.resolve().then(fn); |
46 Object.observe(o, function() { | |
47 fn(); | |
48 }); | |
49 // Change something to enqueue a microtask. | |
50 o.x = 'hello'; | |
51 } | 46 } |
52 | 47 |
53 var context = { | 48 var context = { |
54 beingDescribed: undefined, | 49 beingDescribed: undefined, |
55 currentSuiteIndex: 0, | 50 currentSuiteIndex: 0, |
56 suites: [] | 51 suites: [] |
57 }; | 52 }; |
58 | 53 |
59 function Run() { | 54 function Run() { |
60 function current() { | 55 function current() { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 250 |
256 beforeEach = function(fn) { | 251 beforeEach = function(fn) { |
257 context.beingDescribed.beforeEach = fn; | 252 context.beingDescribed.beforeEach = fn; |
258 } | 253 } |
259 | 254 |
260 afterEach = function(fn) { | 255 afterEach = function(fn) { |
261 context.beingDescribed.afterEach = fn; | 256 context.beingDescribed.afterEach = fn; |
262 } | 257 } |
263 | 258 |
264 }()); | 259 }()); |
OLD | NEW |